aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/entity/PathfinderMob.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/entity/PathfinderMob.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/entity/PathfinderMob.java.patch97
1 files changed, 97 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/entity/PathfinderMob.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/entity/PathfinderMob.java.patch
new file mode 100644
index 0000000000..de4068ef8c
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/entity/PathfinderMob.java.patch
@@ -0,0 +1,97 @@
+--- a/net/minecraft/world/entity/PathfinderMob.java
++++ b/net/minecraft/world/entity/PathfinderMob.java
+@@ -8,27 +8,29 @@
+ import net.minecraft.world.level.LevelAccessor;
+ import net.minecraft.world.level.LevelReader;
+ import net.minecraft.world.phys.Vec3;
++// CraftBukkit start
++import org.bukkit.event.entity.EntityUnleashEvent;
++// CraftBukkit end
+
+ public abstract class PathfinderMob extends Mob {
+
+ protected static final float DEFAULT_WALK_TARGET_VALUE = 0.0F;
+
+- protected PathfinderMob(EntityType<? extends PathfinderMob> entitytype, Level level) {
+- super(entitytype, level);
++ protected PathfinderMob(EntityType<? extends PathfinderMob> entityType, Level level) {
++ super(entityType, level);
+ }
+
+- public float getWalkTargetValue(BlockPos blockpos) {
+- return this.getWalkTargetValue(blockpos, this.level());
++ public float getWalkTargetValue(BlockPos pos) {
++ return this.getWalkTargetValue(pos, this.level());
+ }
+
+- public float getWalkTargetValue(BlockPos blockpos, LevelReader levelreader) {
++ public float getWalkTargetValue(BlockPos pos, LevelReader level) {
+ return 0.0F;
+ }
+
+ @Override
+- @Override
+- public boolean checkSpawnRules(LevelAccessor levelaccessor, MobSpawnType mobspawntype) {
+- return this.getWalkTargetValue(this.blockPosition(), levelaccessor) >= 0.0F;
++ public boolean checkSpawnRules(LevelAccessor level, EnumMobSpawn spawnReason) {
++ return this.getWalkTargetValue(this.blockPosition(), level) >= 0.0F;
+ }
+
+ public boolean isPathFinding() {
+@@ -36,13 +38,12 @@
+ }
+
+ public boolean isPanicking() {
+- return this.brain.hasMemoryValue(MemoryModuleType.IS_PANICKING) ? this.brain.getMemory(MemoryModuleType.IS_PANICKING).isPresent() : this.goalSelector.getRunningGoals().anyMatch((wrappedgoal) -> {
+- return wrappedgoal.getGoal() instanceof PanicGoal;
++ return this.brain.hasMemoryValue(MemoryModuleType.IS_PANICKING) ? this.brain.getMemory(MemoryModuleType.IS_PANICKING).isPresent() : this.goalSelector.getRunningGoals().anyMatch((pathfindergoalwrapped) -> {
++ return pathfindergoalwrapped.getGoal() instanceof PanicGoal;
+ });
+ }
+
+ @Override
+- @Override
+ protected void tickLeash() {
+ super.tickLeash();
+ Entity entity = this.getLeashHolder();
+@@ -53,6 +54,7 @@
+
+ if (this instanceof TamableAnimal && ((TamableAnimal) this).isInSittingPose()) {
+ if (f > 10.0F) {
++ this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
+ this.dropLeash(true, true);
+ }
+
+@@ -61,8 +63,9 @@
+
+ this.onLeashDistance(f);
+ if (f > 10.0F) {
++ this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
+ this.dropLeash(true, true);
+- this.goalSelector.disableControlFlag(Goal.Flag.MOVE);
++ this.goalSelector.disableControlFlag(Goal.Type.MOVE);
+ } else if (f > 6.0F) {
+ double d0 = (entity.getX() - this.getX()) / (double) f;
+ double d1 = (entity.getY() - this.getY()) / (double) f;
+@@ -71,11 +74,11 @@
+ this.setDeltaMovement(this.getDeltaMovement().add(Math.copySign(d0 * d0 * 0.4D, d0), Math.copySign(d1 * d1 * 0.4D, d1), Math.copySign(d2 * d2 * 0.4D, d2)));
+ this.checkSlowFallDistance();
+ } else if (this.shouldStayCloseToLeashHolder() && !this.isPanicking()) {
+- this.goalSelector.enableControlFlag(Goal.Flag.MOVE);
++ this.goalSelector.enableControlFlag(Goal.Type.MOVE);
+ float f1 = 2.0F;
+- Vec3 vec3 = (new Vec3(entity.getX() - this.getX(), entity.getY() - this.getY(), entity.getZ() - this.getZ())).normalize().scale((double) Math.max(f - 2.0F, 0.0F));
++ Vec3 vec3d = (new Vec3(entity.getX() - this.getX(), entity.getY() - this.getY(), entity.getZ() - this.getZ())).normalize().scale((double) Math.max(f - 2.0F, 0.0F));
+
+- this.getNavigation().moveTo(this.getX() + vec3.x, this.getY() + vec3.y, this.getZ() + vec3.z, this.followLeashSpeed());
++ this.getNavigation().moveTo(this.getX() + vec3d.x, this.getY() + vec3d.y, this.getZ() + vec3d.z, this.followLeashSpeed());
+ }
+ }
+
+@@ -89,5 +92,5 @@
+ return 1.0D;
+ }
+
+- protected void onLeashDistance(float f) {}
++ protected void onLeashDistance(float distance) {}
+ }