Paper/Spigot-Server-Patches/0010-Allow-nerfed-mobs-to-jump.patch

86 lines
3.6 KiB
Diff
Raw Normal View History

2018-01-11 06:31:19 +01:00
From 9c02dc7968f42b1d0a021055f6d72c5d074eeb48 Mon Sep 17 00:00:00 2001
2015-01-29 22:25:50 +01:00
From: Zach Brown <zach.brown@destroystokyo.com>
2016-03-01 00:09:49 +01:00
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
2018-01-11 06:31:19 +01:00
index 45bddf3f..1d9dd0e0 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
2018-01-11 06:31:19 +01:00
@@ -86,4 +86,9 @@ public class PaperWorldConfig {
2016-11-17 03:23:38 +01:00
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
2018-01-11 06:31:19 +01:00
index 4f2fa59a..8af52a61 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.l(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
2018-01-11 06:31:19 +01:00
index 3c48d946..7b02b253 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
2017-07-28 15:45:16 +02:00
@@ -46,6 +46,7 @@ public abstract class EntityInsentient extends EntityLiving {
2017-05-14 20:05:01 +02:00
private boolean bE;
2016-03-01 00:09:49 +01:00
private Entity leashHolder;
2017-05-14 20:05:01 +02:00
private NBTTagCompound bG;
2017-06-11 19:03:07 +02:00
+ @Nullable public PathfinderGoalFloat goalFloat; // Paper
public EntityInsentient(World world) {
super(world);
2017-07-28 15:45:16 +02:00
@@ -651,6 +652,12 @@ public abstract class EntityInsentient extends EntityLiving {
2017-06-11 19:03:07 +02:00
// Spigot Start
if ( this.fromMobSpawner )
{
2016-03-01 00:09:49 +01:00
+ // Paper start - Allow nerfed mobs to jump and float
+ if (goalFloat != null) {
+ if (goalFloat.validConditions()) goalFloat.update();
+ this.getControllerJump().jumpIfSet();
+ }
2016-03-01 00:09:49 +01:00
+ // Paper end
2017-06-11 19:03:07 +02:00
return;
}
// Spigot End
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java
2018-01-11 06:31:19 +01:00
index b3b303b3..fc6c3bf7 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java
2017-05-14 20:05:01 +02:00
@@ -6,6 +6,7 @@ public class PathfinderGoalFloat extends PathfinderGoal {
public PathfinderGoalFloat(EntityInsentient entityinsentient) {
this.a = entityinsentient;
+ if (entityinsentient.getWorld().paperConfig.nerfedMobsShouldJump) entityinsentient.goalFloat = this; // Paper
this.a(4);
2017-05-14 20:05:01 +02:00
if (entityinsentient.getNavigation() instanceof Navigation) {
((Navigation) entityinsentient.getNavigation()).c(true);
@@ -15,10 +16,12 @@ public class PathfinderGoalFloat extends PathfinderGoal {
}
+ public boolean validConditions() { return this.a(); } // Paper - OBFHELPER
public boolean a() {
2017-05-14 20:05:01 +02:00
return this.a.isInWater() || this.a.au();
}
+ public void update() { this.e(); } // Paper - OBFHELPER
public void e() {
if (this.a.getRandom().nextFloat() < 0.8F) {
this.a.getControllerJump().a();
--
2.14.3