Paper/Spigot-Server-Patches/0013-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch
Aikar e4d10a6d67
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
122289ff Add FaceAttachable interface to handle Grindstone facing in common with Switches
a6db750e SPIGOT-5647: ZombieVillager entity should have getVillagerType()

CraftBukkit Changes:
bbe3d58e SPIGOT-5650: Lectern.setPage(int) causes a NullPointerException
3075579f Add FaceAttachable interface to handle Grindstone facing in common with Switches
95bd4238 SPIGOT-5647: ZombieVillager entity should have getVillagerType()
4d975ac3 SPIGOT-5617: setBlockData does not work when NotPlayEvent is called by redstone current
2020-04-02 17:09:17 -04:00

117 lines
5.4 KiB
Diff

From 42a58e4d6628de5ed09c9226c0a2cdbaf4a05fa3 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 and take water damage
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 7d9976ce6b..6d6a68cb1b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -92,4 +92,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/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index e9d0a4eb90..957330b673 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1103,6 +1103,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return this.isInWater() || this.isInRain();
}
+ public boolean isInWaterOrRainOrBubble() { return ay(); } // Paper - OBFHELPER
public boolean ay() {
return this.isInWater() || this.isInRain() || this.l();
}
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
index 1cc66108d0..538c2169cd 100644
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -171,7 +171,7 @@ public class EntityEnderman extends EntityMonster {
@Override
protected void mobTick() {
if (this.ay()) {
- this.damageEntity(DamageSource.DROWN, 1.0F);
+ this.damageEntity(DamageSource.DROWN, 1.0F); // Paper - copied in patch 13 (allow nerfed mobs to jump, float and take water damage)
}
if (this.world.isDay() && this.ticksLived >= this.bA + 600) {
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 0b06fa2b66..70cd0801dc 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 bw;
@@ -648,7 +649,17 @@ public abstract class EntityInsentient extends EntityLiving {
@Override
protected final void doTick() {
++this.ticksFarFromPlayer;
- if (!this.aware) return; // CraftBukkit
+ if (!this.aware) { // Paper start - Allow nerfed mobs to jump, float and take water damage
+ if (goalFloat != null) {
+ if (goalFloat.validConditions()) goalFloat.update();
+ this.getControllerJump().jumpIfSet();
+ }
+ if ((this instanceof EntityBlaze || this instanceof EntityEnderman) && isInWaterOrRainOrBubble()) {
+ damageEntity(DamageSource.DROWN, 1.0F);
+ }
+ return;
+ }
+ // Paper end
this.world.getMethodProfiler().enter("sensing");
this.bw.a();
this.world.getMethodProfiler().exit();
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java
index 0f0dc7277f..43908b0400 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.co() > d0 || this.a.aH();
}
+ public void update() { this.e(); } // Paper - OBFHELPER
@Override
public void e() {
if (this.a.getRandom().nextFloat() < 0.8F) {
--
2.25.1