SPIGOT-7295: Fix Sniffer data defined in incorrect position

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2023-03-16 06:48:37 +11:00
parent 85db37be1b
commit 4b03485bd2

View file

@ -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<? extends EntityAnimal> 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<BlockPosition> 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<Sniffer> getBrain() {
- return super.getBrain();
+ return (BehaviorController<Sniffer>) super.getBrain(); // CraftBukkit - decompile error
}
@Override