2017-05-21 06:41:39 +02:00
|
|
|
From 2f4bb5350f76ae64af9b869da3322c0726eed973 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
|
2014-06-29 20:34:16 +02:00
|
|
|
Subject: [PATCH] Allow nerfed mobs to jump
|
|
|
|
|
|
|
|
|
2016-03-19 03:10:20 +01:00
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2017-03-25 04:18:58 +01:00
|
|
|
index 22999f0d2..5f13fbff3 100644
|
2016-03-19 03:10:20 +01:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2017-03-25 04:18:58 +01:00
|
|
|
@@ -94,4 +94,9 @@ public class PaperWorldConfig {
|
2016-11-17 03:23:38 +01:00
|
|
|
fishingMaxTicks = getInt("fishing-time-range.MaximumTicks", 600);
|
2016-03-19 03:10:20 +01: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 04:57:07 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/ControllerJump.java b/src/main/java/net/minecraft/server/ControllerJump.java
|
|
|
|
index 4f2fa59ac..8af52a61f 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;
|
2017-05-21 06:41:39 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
index 0e70cdf6f..8a61c2369 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
@@ -109,6 +109,7 @@ public abstract class Entity implements ICommandListener {
|
|
|
|
public boolean noclip;
|
|
|
|
public float R;
|
|
|
|
protected Random random;
|
|
|
|
+ public boolean fromMobSpawner; // Paper
|
|
|
|
public int ticksLived;
|
|
|
|
public int fireTicks;
|
|
|
|
public boolean inWater; // Spigot - protected -> public // PAIL
|
2014-06-29 20:34:16 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
2017-05-21 06:41:39 +02:00
|
|
|
index 67f26bd62..6adb38de0 100644
|
2014-06-29 20:34:16 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
2016-12-21 04:57:07 +01:00
|
|
|
@@ -44,6 +44,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;
|
2016-03-01 00:09:49 +01:00
|
|
|
+ public PathfinderGoalFloat goalFloat; // Paper
|
2015-07-14 19:51:38 +02:00
|
|
|
|
|
|
|
public EntityInsentient(World world) {
|
|
|
|
super(world);
|
2017-05-21 06:41:39 +02:00
|
|
|
@@ -638,6 +639,17 @@ public abstract class EntityInsentient extends EntityLiving {
|
|
|
|
this.world.methodProfiler.a("checkDespawn");
|
|
|
|
this.L();
|
|
|
|
this.world.methodProfiler.b();
|
|
|
|
+ // Paper start - Re-add so we can allow them to float in water
|
|
|
|
+ if (this.fromMobSpawner) {
|
2016-03-01 00:09:49 +01:00
|
|
|
+ // Paper start - Allow nerfed mobs to jump and float
|
2015-07-14 19:51:38 +02:00
|
|
|
+ if (goalFloat != null) {
|
2016-12-21 04:57:07 +01:00
|
|
|
+ if (goalFloat.validConditions()) goalFloat.update();
|
|
|
|
+ this.getControllerJump().jumpIfSet();
|
2015-07-14 19:51:38 +02:00
|
|
|
+ }
|
2016-03-01 00:09:49 +01:00
|
|
|
+ // Paper end
|
2017-05-21 06:41:39 +02:00
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // Spigot End
|
|
|
|
this.world.methodProfiler.a("sensing");
|
|
|
|
this.bw.a();
|
|
|
|
this.world.methodProfiler.b();
|
2015-07-14 19:51:38 +02:00
|
|
|
diff --git 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
|
|
|
index b3b303b3b..fc8be86fd 100644
|
2015-07-14 19:51:38 +02:00
|
|
|
--- 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 {
|
2015-07-14 19:51:38 +02:00
|
|
|
|
|
|
|
public PathfinderGoalFloat(EntityInsentient entityinsentient) {
|
|
|
|
this.a = entityinsentient;
|
2016-12-21 04:57:07 +01:00
|
|
|
+ if (entityinsentient.fromMobSpawner && entityinsentient.getWorld().paperConfig.nerfedMobsShouldJump) entityinsentient.goalFloat = this; // Paper
|
2015-07-14 19:51:38 +02:00
|
|
|
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 {
|
|
|
|
|
2015-07-14 19:51:38 +02:00
|
|
|
}
|
2016-12-21 04:57:07 +01:00
|
|
|
|
|
|
|
+ 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();
|
2016-12-21 04:57:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
+ public void update() { this.e(); } // Paper - OBFHELPER
|
|
|
|
public void e() {
|
|
|
|
if (this.a.getRandom().nextFloat() < 0.8F) {
|
|
|
|
this.a.getControllerJump().a();
|
2017-05-21 06:41:39 +02:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
|
|
index 825ca9346..2f409fe1e 100644
|
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
|
|
@@ -557,7 +557,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean hasAI() {
|
|
|
|
- return (this.getHandle() instanceof EntityInsentient) ? !((EntityInsentient) this.getHandle()).isNoAI(): false;
|
|
|
|
+ return this.getHandle() instanceof EntityInsentient && (!((EntityInsentient) this.getHandle()).isNoAI() || this.getHandle().getWorld().spigotConfig.nerfSpawnerMobs && ((EntityInsentient) this.getHandle()).fromMobSpawner); // Paper
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-06-29 20:34:16 +02:00
|
|
|
--
|
2017-05-21 06:41:39 +02:00
|
|
|
2.13.0.windows.1
|
2014-06-29 20:34:16 +02:00
|
|
|
|