From 4b03485bd2913606c57e0f1623b826141675f201 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Thu, 16 Mar 2023 06:48:37 +1100 Subject: [PATCH] SPIGOT-7295: Fix Sniffer data defined in incorrect position By: md_5 --- .../world/entity/animal/sniffer/Sniffer.patch | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 paper-server/nms-patches/net/minecraft/world/entity/animal/sniffer/Sniffer.patch diff --git a/paper-server/nms-patches/net/minecraft/world/entity/animal/sniffer/Sniffer.patch b/paper-server/nms-patches/net/minecraft/world/entity/animal/sniffer/Sniffer.patch new file mode 100644 index 0000000000..8c881f8e6a --- /dev/null +++ b/paper-server/nms-patches/net/minecraft/world/entity/animal/sniffer/Sniffer.patch @@ -0,0 +1,44 @@ +--- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java ++++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java +@@ -75,12 +75,21 @@ + + public Sniffer(EntityTypes entitytypes, World world) { + super(entitytypes, world); +- this.entityData.define(Sniffer.DATA_STATE, Sniffer.a.IDLING); +- this.entityData.define(Sniffer.DATA_DROP_SEED_AT_TICK, 0); ++ // this.entityData.define(Sniffer.DATA_STATE, Sniffer.a.IDLING); // CraftBukkit - moved down to appropriate location ++ // this.entityData.define(Sniffer.DATA_DROP_SEED_AT_TICK, 0); // CraftBukkit - moved down to appropriate location + this.getNavigation().setCanFloat(true); + this.setPathfindingMalus(PathType.WATER, -2.0F); + } + ++ // CraftBukkit start - SPIGOT-7295: moved from constructor to appropriate location ++ @Override ++ protected void defineSynchedData() { ++ super.defineSynchedData(); ++ this.entityData.define(Sniffer.DATA_STATE, Sniffer.a.IDLING); ++ this.entityData.define(Sniffer.DATA_DROP_SEED_AT_TICK, 0); ++ } ++ // CraftBukkit end ++ + @Override + protected float getStandingEyeHeight(EntityPose entitypose, EntitySize entitysize) { + return this.getDimensions(entitypose).height * 0.6F; +@@ -278,7 +287,7 @@ + List list = (List) this.getExploredPositions().limit(20L).collect(Collectors.toList()); + + list.add(0, blockposition); +- this.getBrain().setMemory(MemoryModuleType.SNIFFER_EXPLORED_POSITIONS, (Object) list); ++ this.getBrain().setMemory(MemoryModuleType.SNIFFER_EXPLORED_POSITIONS, list); // CraftBukkit - decompile error + return this; + } + +@@ -416,7 +425,7 @@ + + @Override + public BehaviorController getBrain() { +- return super.getBrain(); ++ return (BehaviorController) super.getBrain(); // CraftBukkit - decompile error + } + + @Override