From 5b97ebeb6ed39563881aebabe1c14a2061b568dc Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 1 Mar 2016 13:24:16 -0600 Subject: [PATCH] Allow nerfed mobs to jump diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java index a55163a458..341038fc4d 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -87,4 +87,9 @@ public class PaperWorldConfig { fishingMaxTicks = getInt("fishing-time-range.MaximumTicks", 600); log("Fishing time ranges are between " + fishingMinTicks +" and " + fishingMaxTicks + " ticks"); } + + public boolean nerfedMobsShouldJump; + private void nerfedMobsShouldJump() { + nerfedMobsShouldJump = getBoolean("spawner-nerfed-mobs-should-jump", false); + } } diff --git a/src/main/java/net/minecraft/server/ControllerJump.java b/src/main/java/net/minecraft/server/ControllerJump.java index 2e869004c8..8a6856e0fd 100644 --- a/src/main/java/net/minecraft/server/ControllerJump.java +++ b/src/main/java/net/minecraft/server/ControllerJump.java @@ -13,6 +13,7 @@ public class ControllerJump { this.a = true; } + public void jumpIfSet() { this.b(); } // Paper - OBFHELPER public void b() { this.b.setJumping(this.a); this.a = false; diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java index 6d7b313aeb..3a96f70d89 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -32,6 +32,7 @@ public abstract class EntityInsentient extends EntityLiving { private final EntityAIBodyControl c; protected NavigationAbstract navigation; public PathfinderGoalSelector goalSelector; + @Nullable public PathfinderGoalFloat goalFloat; // Paper public PathfinderGoalSelector targetSelector; private EntityLiving goalTarget; private final EntitySenses bz; @@ -637,6 +638,12 @@ public abstract class EntityInsentient extends EntityLiving { // Spigot Start if ( this.fromMobSpawner ) { + // Paper start - Allow nerfed mobs to jump and float + if (goalFloat != null) { + if (goalFloat.validConditions()) goalFloat.update(); + this.getControllerJump().jumpIfSet(); + } + // Paper end return; } // Spigot End diff --git a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java index 71b399c65c..2e23b5de59 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java @@ -8,10 +8,12 @@ public class PathfinderGoalFloat extends PathfinderGoal { public PathfinderGoalFloat(EntityInsentient entityinsentient) { this.a = entityinsentient; + if (entityinsentient.getWorld().paperConfig.nerfedMobsShouldJump) entityinsentient.goalFloat = this; // Paper this.a(EnumSet.of(PathfinderGoal.Type.JUMP)); entityinsentient.getNavigation().d(true); } + public final boolean validConditions() { return this.a(); } // Paper - OBFHELPER @Override public boolean a() { double d0 = (double) this.a.getHeadHeight() < 0.4D ? 0.2D : 0.4D; @@ -19,6 +21,7 @@ public class PathfinderGoalFloat extends PathfinderGoal { return this.a.isInWater() && this.a.cf() > d0 || this.a.aD(); } + public void update() { this.e(); } // Paper - OBFHELPER @Override public void e() { if (this.a.getRandom().nextFloat() < 0.8F) { -- 2.22.0