summaryrefslogtreecommitdiffstats
path: root/nms-patches
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2018-11-06 18:03:42 +1100
committermd_5 <git@md-5.net>2018-11-06 18:06:56 +1100
commitde547749ec4c80d540a9992f67a8937fe53359f2 (patch)
tree0c478c4fb05e2440b309a9fdbb5e1378067565df /nms-patches
parente693496c17562b3e865b545f755562bcad81f2e8 (diff)
downloadcraftbukkit-de547749ec4c80d540a9992f67a8937fe53359f2.tar
craftbukkit-de547749ec4c80d540a9992f67a8937fe53359f2.tar.gz
craftbukkit-de547749ec4c80d540a9992f67a8937fe53359f2.tar.lz
craftbukkit-de547749ec4c80d540a9992f67a8937fe53359f2.tar.xz
craftbukkit-de547749ec4c80d540a9992f67a8937fe53359f2.zip
SPIGOT-4471: Use wall time for zombie drowning & enhance checks
Thanks Zach Brown for outline of issue with drowned zombies.
Diffstat (limited to 'nms-patches')
-rw-r--r--nms-patches/EntityZombie.patch43
-rw-r--r--nms-patches/EntityZombieVillager.patch7
2 files changed, 38 insertions, 12 deletions
diff --git a/nms-patches/EntityZombie.patch b/nms-patches/EntityZombie.patch
index 25380ca7..4a6dc06c 100644
--- a/nms-patches/EntityZombie.patch
+++ b/nms-patches/EntityZombie.patch
@@ -4,17 +4,40 @@
import java.util.UUID;
import javax.annotation.Nullable;
-+//CraftBukkit start
++// CraftBukkit start
+import org.bukkit.event.entity.CreatureSpawnEvent;
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
+import org.bukkit.event.entity.EntityCombustEvent;
+import org.bukkit.event.entity.EntityTargetEvent;
-+//CraftBukkit end
++// CraftBukkit end
+
public class EntityZombie extends EntityMonster {
protected static final IAttribute c = (new AttributeRanged((IAttribute) null, "zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance");
-@@ -182,7 +189,14 @@
+@@ -21,6 +28,7 @@
+ private int bJ;
+ private float bK;
+ private float bL;
++ private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
+
+ public EntityZombie(EntityTypes<?> entitytypes, World world) {
+ super(entitytypes, world);
+@@ -143,8 +151,12 @@
+
+ public void tick() {
+ if (!this.world.isClientSide) {
+- if (this.dG()) {
+- --this.bJ;
++ // CraftBukkit start - Use wall time instead of ticks for conversion
++ if (this.dG() && this.isAlive()) {
++ int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
++ this.lastTick = MinecraftServer.currentTick;
++ this.bJ -= elapsedTicks;
++ // CraftBukkit end
+ if (this.bJ < 0) {
+ this.dE();
+ }
+@@ -182,7 +194,14 @@
}
if (flag) {
@@ -30,7 +53,7 @@
}
}
-@@ -221,7 +235,7 @@
+@@ -221,7 +240,7 @@
entityzombie.setCustomNameVisible(this.getCustomNameVisible());
}
@@ -39,7 +62,7 @@
this.die();
}
}
-@@ -252,8 +266,8 @@
+@@ -252,8 +271,8 @@
if (this.world.getType(new BlockPosition(i1, j1 - 1, k1)).q() && this.world.getLightLevel(new BlockPosition(i1, j1, k1)) < 10) {
entityzombie.setPosition((double) i1, (double) j1, (double) k1);
if (!this.world.isPlayerNearby((double) i1, (double) j1, (double) k1, 7.0D) && this.world.a_(entityzombie, entityzombie.getBoundingBox()) && this.world.getCubes(entityzombie, entityzombie.getBoundingBox()) && !this.world.containsLiquid(entityzombie.getBoundingBox())) {
@@ -50,7 +73,7 @@
entityzombie.prepare(this.world.getDamageScaler(new BlockPosition(entityzombie)), (GroupDataEntity) null, (NBTTagCompound) null);
this.getAttributeInstance(EntityZombie.c).b(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0));
entityzombie.getAttributeInstance(EntityZombie.c).b(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0));
-@@ -276,7 +290,14 @@
+@@ -276,7 +295,14 @@
float f = this.world.getDamageScaler(new BlockPosition(this)).b();
if (this.getItemInMainHand().isEmpty() && this.isBurning() && this.random.nextFloat() < f * 0.3F) {
@@ -66,7 +89,7 @@
}
}
-@@ -372,7 +393,7 @@
+@@ -372,7 +398,7 @@
entityzombievillager.setCustomNameVisible(entityvillager.getCustomNameVisible());
}
@@ -75,7 +98,7 @@
this.world.a((EntityHuman) null, 1026, new BlockPosition(this), 0);
}
-@@ -422,7 +443,7 @@
+@@ -422,7 +448,7 @@
entitychicken1.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
entitychicken1.prepare(difficultydamagescaler, (GroupDataEntity) null, (NBTTagCompound) null);
entitychicken1.s(true);
@@ -84,7 +107,7 @@
this.startRiding(entitychicken1);
}
}
-@@ -495,7 +516,7 @@
+@@ -495,7 +521,7 @@
}
public void die(DamageSource damagesource) {
@@ -93,7 +116,7 @@
if (damagesource.getEntity() instanceof EntityCreeper) {
EntityCreeper entitycreeper = (EntityCreeper) damagesource.getEntity();
-@@ -508,6 +529,7 @@
+@@ -508,6 +534,7 @@
}
}
}
diff --git a/nms-patches/EntityZombieVillager.patch b/nms-patches/EntityZombieVillager.patch
index b04cbf5f..adbd9da4 100644
--- a/nms-patches/EntityZombieVillager.patch
+++ b/nms-patches/EntityZombieVillager.patch
@@ -8,9 +8,12 @@
public EntityZombieVillager(World world) {
super(EntityTypes.ZOMBIE_VILLAGER, world);
-@@ -56,6 +57,11 @@
+@@ -54,8 +55,13 @@
+ }
+
public void tick() {
- if (!this.world.isClientSide && this.isConverting()) {
+- if (!this.world.isClientSide && this.isConverting()) {
++ if (!this.world.isClientSide && this.isConverting() && this.isAlive()) { // CraftBukkit
int i = this.dK();
+ // CraftBukkit start - Use wall time instead of ticks for villager conversion
+ int elapsedTicks = MinecraftServer.currentTick - this.lastTick;