2019-05-06 00:57:14 +00:00
|
|
|
From 4f0c049efe8ce67de93b3004a3ad46b7013acf47 Mon Sep 17 00:00:00 2001
|
2015-01-29 21:25:50 +00:00
|
|
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
2016-02-29 23:09:49 +00:00
|
|
|
Date: Tue, 1 Mar 2016 13:24:16 -0600
|
2014-06-29 18:34:16 +00:00
|
|
|
Subject: [PATCH] Allow nerfed mobs to jump
|
|
|
|
|
|
|
|
|
2016-03-19 02:10:20 +00:00
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2019-04-23 04:47:07 +00:00
|
|
|
index a55163a458..341038fc4d 100644
|
2016-03-19 02:10:20 +00:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2018-07-24 00:24:44 +00:00
|
|
|
@@ -87,4 +87,9 @@ public class PaperWorldConfig {
|
2016-11-17 02:23:38 +00:00
|
|
|
fishingMaxTicks = getInt("fishing-time-range.MaximumTicks", 600);
|
2016-03-19 02:10:20 +00:00
|
|
|
log("Fishing time ranges are between " + fishingMinTicks +" and " + fishingMaxTicks + " ticks");
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public boolean nerfedMobsShouldJump;
|
|
|
|
+ private void nerfedMobsShouldJump() {
|
|
|
|
+ nerfedMobsShouldJump = getBoolean("spawner-nerfed-mobs-should-jump", false);
|
|
|
|
+ }
|
|
|
|
}
|
2016-12-21 03:57:07 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/ControllerJump.java b/src/main/java/net/minecraft/server/ControllerJump.java
|
2019-04-24 01:00:24 +00:00
|
|
|
index 2e869004c8..8a6856e0fd 100644
|
2016-12-21 03:57:07 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/ControllerJump.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ControllerJump.java
|
2019-01-01 03:15:55 +00:00
|
|
|
@@ -13,6 +13,7 @@ public class ControllerJump {
|
2016-12-21 03:57:07 +00:00
|
|
|
this.a = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ public void jumpIfSet() { this.b(); } // Paper - OBFHELPER
|
|
|
|
public void b() {
|
2019-04-24 01:00:24 +00:00
|
|
|
this.b.setJumping(this.a);
|
2016-12-21 03:57:07 +00:00
|
|
|
this.a = false;
|
2014-06-29 18:34:16 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
2019-04-24 01:00:24 +00:00
|
|
|
index afa03ce6f2..d49047abc1 100644
|
2014-06-29 18:34:16 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
2019-04-24 01:00:24 +00:00
|
|
|
@@ -31,6 +31,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
|
|
|
private final EntityAIBodyControl c;
|
2018-07-15 01:53:17 +00:00
|
|
|
protected NavigationAbstract navigation;
|
|
|
|
public PathfinderGoalSelector goalSelector;
|
2017-06-11 17:03:07 +00:00
|
|
|
+ @Nullable public PathfinderGoalFloat goalFloat; // Paper
|
2018-07-15 01:53:17 +00:00
|
|
|
public PathfinderGoalSelector targetSelector;
|
|
|
|
private EntityLiving goalTarget;
|
2019-04-24 01:00:24 +00:00
|
|
|
private final EntitySenses bz;
|
|
|
|
@@ -640,6 +641,12 @@ public abstract class EntityInsentient extends EntityLiving {
|
2017-06-11 17:03:07 +00:00
|
|
|
// Spigot Start
|
|
|
|
if ( this.fromMobSpawner )
|
|
|
|
{
|
2016-02-29 23:09:49 +00:00
|
|
|
+ // Paper start - Allow nerfed mobs to jump and float
|
2015-07-14 17:51:38 +00:00
|
|
|
+ if (goalFloat != null) {
|
2016-12-21 03:57:07 +00:00
|
|
|
+ if (goalFloat.validConditions()) goalFloat.update();
|
|
|
|
+ this.getControllerJump().jumpIfSet();
|
2015-07-14 17:51:38 +00:00
|
|
|
+ }
|
2016-02-29 23:09:49 +00:00
|
|
|
+ // Paper end
|
2017-06-11 17:03:07 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
// Spigot End
|
2015-07-14 17:51:38 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java
|
2019-05-06 00:57:14 +00:00
|
|
|
index 040a64471f..a10532b0f8 100644
|
2015-07-14 17:51:38 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java
|
2019-05-06 00:57:14 +00:00
|
|
|
@@ -8,10 +8,12 @@ public class PathfinderGoalFloat extends PathfinderGoal {
|
2015-07-14 17:51:38 +00:00
|
|
|
|
|
|
|
public PathfinderGoalFloat(EntityInsentient entityinsentient) {
|
|
|
|
this.a = entityinsentient;
|
2017-10-31 15:13:55 +00:00
|
|
|
+ if (entityinsentient.getWorld().paperConfig.nerfedMobsShouldJump) entityinsentient.goalFloat = this; // Paper
|
2019-04-24 01:00:24 +00:00
|
|
|
this.a(EnumSet.of(PathfinderGoal.Type.JUMP));
|
2018-07-22 05:27:46 +00:00
|
|
|
entityinsentient.getNavigation().d(true);
|
2015-07-14 17:51:38 +00:00
|
|
|
}
|
2019-05-06 00:57:14 +00:00
|
|
|
|
|
|
|
+ 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 {
|
2019-04-24 01:00:24 +00:00
|
|
|
return this.a.isInWater() && this.a.ce() > d0 || this.a.aC();
|
2016-12-21 03:57:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ public void update() { this.e(); } // Paper - OBFHELPER
|
2019-04-24 01:00:24 +00:00
|
|
|
@Override
|
2016-12-21 03:57:07 +00:00
|
|
|
public void e() {
|
|
|
|
if (this.a.getRandom().nextFloat() < 0.8F) {
|
2014-06-29 18:34:16 +00:00
|
|
|
--
|
2019-04-23 04:47:07 +00:00
|
|
|
2.21.0
|
2014-06-29 18:34:16 +00:00
|
|
|
|