Paper/Spigot-Server-Patches/0013-Allow-nerfed-mobs-to-jump.patch
Zach Brown a2ad49b22f
Update upstream BD/B/CB/S
Note to other developers: This commit may require you to wipe your
workspace as a result of the changes to BD.

--- work/BuildData
Submodule work/BuildData f527a8ff..d56672db:
  > Mappings Update

--- work/Bukkit
Submodule work/Bukkit 0c1d258bb..db06c80d7:
  > Add list of entities to EntityTransformEvent
  > SPIGOT-4347: Add API to allow storing arbitrary values on ItemStacks

---work/CraftBukkit
Submodule work/CraftBukkit 6a398ac44..068dab5be:
  > Enable optional source JAR shading via profile shadeSourcesJar
  > Use ImmutableList rather than AbstractList for CraftMetaBook
  > Fix setRecipes(List) not setting Knowledge Book recipes.
  > Mappings Update
  > Add list of entities to EntityTransformEvent & move die calls
  > SPIGOT-4347: Add API to allow storing arbitrary values on ItemStacks
  > Add Vanilla help to default permissions

--- work/Spigot
Submodule work/Spigot a1f2566f6..e769fe4d9:
  > Mappings Update
  > Rebuild patches
2018-12-08 05:09:55 -05:00

83 lines
3.6 KiB
Diff

From 0b7b250edea62c25ecaa5abf3a83298d4365d9ef Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
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 a55163a45..341038fc4 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 74a40671e..5d6260ded 100644
--- a/src/main/java/net/minecraft/server/ControllerJump.java
+++ b/src/main/java/net/minecraft/server/ControllerJump.java
@@ -12,6 +12,7 @@ public class ControllerJump {
this.a = true;
}
+ public void jumpIfSet() { this.b(); } // Paper - OBFHELPER
public void b() {
this.b.o(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 7cf459d26..9d4d8c697 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 b;
protected NavigationAbstract navigation;
public PathfinderGoalSelector goalSelector;
+ @Nullable public PathfinderGoalFloat goalFloat; // Paper
public PathfinderGoalSelector targetSelector;
private EntityLiving goalTarget;
private final EntitySenses bC;
@@ -646,6 +647,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 15c04f890..7db180fa9 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java
@@ -5,14 +5,17 @@ public class PathfinderGoalFloat extends PathfinderGoal {
public PathfinderGoalFloat(EntityInsentient entityinsentient) {
this.a = entityinsentient;
+ if (entityinsentient.getWorld().paperConfig.nerfedMobsShouldJump) entityinsentient.goalFloat = this; // Paper
this.a(4);
entityinsentient.getNavigation().d(true);
}
+ public boolean validConditions() { return this.a(); } // Paper - OBFHELPER
public boolean a() {
return this.a.isInWater() && this.a.bY() > 0.4D || this.a.ax();
}
+ public void update() { this.e(); } // Paper - OBFHELPER
public void e() {
if (this.a.getRandom().nextFloat() < 0.8F) {
this.a.getControllerJump().a();
--
2.19.2