From aa008dff0f9bedbe88e1fe79831776b0a52eb90a Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 1 Mar 2016 08:32:46 +1100 Subject: Update to Minecraft 1.9 --- nms-patches/EntityZombie.patch | 73 ++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 42 deletions(-) (limited to 'nms-patches/EntityZombie.patch') diff --git a/nms-patches/EntityZombie.patch b/nms-patches/EntityZombie.patch index 81e42311..d672aaca 100644 --- a/nms-patches/EntityZombie.patch +++ b/nms-patches/EntityZombie.patch @@ -1,11 +1,10 @@ --- a/net/minecraft/server/EntityZombie.java +++ b/net/minecraft/server/EntityZombie.java -@@ -4,6 +4,14 @@ +@@ -4,6 +4,13 @@ import java.util.List; import java.util.UUID; +//CraftBukkit start -+import org.bukkit.craftbukkit.entity.CraftLivingEntity; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.EntityCombustByEntityEvent; +import org.bukkit.event.entity.EntityCombustEvent; @@ -15,15 +14,15 @@ public class EntityZombie extends EntityMonster { protected static final IAttribute a = (new AttributeRanged((IAttribute) null, "zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance"); -@@ -14,6 +22,7 @@ - private boolean bo = false; - private float bp = -1.0F; - private float bq; +@@ -18,6 +25,7 @@ + private boolean bB = false; + private float bC = -1.0F; + private float bD; + private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field public EntityZombie(World world) { super(world); -@@ -135,7 +144,14 @@ +@@ -152,7 +160,14 @@ } if (flag) { @@ -39,34 +38,33 @@ } } } -@@ -169,8 +185,8 @@ - if (World.a((IBlockAccess) this.world, new BlockPosition(i1, j1 - 1, k1)) && this.world.getLightLevel(new BlockPosition(i1, j1, k1)) < 10) { +@@ -182,8 +197,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.getBoundingBox(), (Entity) entityzombie) && this.world.getCubes(entityzombie, entityzombie.getBoundingBox()).isEmpty() && !this.world.containsLiquid(entityzombie.getBoundingBox())) { - this.world.addEntity(entityzombie); - entityzombie.setGoalTarget(entityliving); + this.world.addEntity(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit + entityzombie.setGoalTarget(entityliving, EntityTargetEvent.TargetReason.REINFORCEMENT_TARGET, true); - entityzombie.prepare(this.world.E(new BlockPosition(entityzombie)), (GroupDataEntity) null); + entityzombie.prepare(this.world.D(new BlockPosition(entityzombie)), (GroupDataEntity) null); this.getAttributeInstance(EntityZombie.a).b(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0)); entityzombie.getAttributeInstance(EntityZombie.a).b(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0)); -@@ -190,6 +206,12 @@ - if (!this.world.isClientSide && this.cp()) { - int i = this.cr(); - +@@ -202,6 +217,11 @@ + public void m() { + if (!this.world.isClientSide && this.isConverting()) { + int i = this.getConversionTime(); + // CraftBukkit start - Use wall time instead of ticks for villager conversion + int elapsedTicks = MinecraftServer.currentTick - this.lastTick; + this.lastTick = MinecraftServer.currentTick; + i *= elapsedTicks; + // CraftBukkit end -+ - this.bn -= i; - if (this.bn <= 0) { - this.cq(); -@@ -206,7 +228,14 @@ + + this.bA -= i; + if (this.bA <= 0) { +@@ -219,7 +239,14 @@ int i = this.world.getDifficulty().a(); - if (this.bA() == null && this.isBurning() && this.random.nextFloat() < (float) i * 0.3F) { + if (this.getItemInMainHand() == null && this.isBurning() && this.random.nextFloat() < (float) i * 0.3F) { - entity.setOnFire(2 * i); + // CraftBukkit start + EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 2 * i); @@ -79,50 +77,41 @@ } } -@@ -322,7 +351,7 @@ - entityzombie.setCustomNameVisible(entityinsentient.getCustomNameVisible()); +@@ -321,7 +348,7 @@ + entityzombie.setCustomNameVisible(entityvillager.getCustomNameVisible()); } - this.world.addEntity(entityzombie); + this.world.addEntity(entityzombie, CreatureSpawnEvent.SpawnReason.INFECTION); // CraftBukkit - add SpawnReason - this.world.a((EntityHuman) null, 1016, new BlockPosition((int) this.locX, (int) this.locY, (int) this.locZ), 0); + this.world.a((EntityHuman) null, 1026, new BlockPosition((int) this.locX, (int) this.locY, (int) this.locZ), 0); } -@@ -375,7 +404,7 @@ +@@ -374,7 +401,7 @@ entitychicken1.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F); entitychicken1.prepare(difficultydamagescaler, (GroupDataEntity) null); - entitychicken1.l(true); + entitychicken1.o(true); - this.world.addEntity(entitychicken1); -+ this.world.addEntity(entitychicken1, CreatureSpawnEvent.SpawnReason.MOUNT); - this.mount(entitychicken1); ++ this.world.addEntity(entitychicken1, CreatureSpawnEvent.SpawnReason.MOUNT); // CraftBukkit + this.startRiding(entitychicken1); } } -@@ -464,7 +493,7 @@ +@@ -458,7 +485,7 @@ entityvillager.setCustomNameVisible(this.getCustomNameVisible()); } - this.world.addEntity(entityvillager); + this.world.addEntity(entityvillager, CreatureSpawnEvent.SpawnReason.CURED); // CraftBukkit - add SpawnReason - entityvillager.addEffect(new MobEffect(MobEffectList.CONFUSION.id, 200, 0)); - this.world.a((EntityHuman) null, 1017, new BlockPosition((int) this.locX, (int) this.locY, (int) this.locZ), 0); + entityvillager.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0)); + this.world.a((EntityHuman) null, 1027, new BlockPosition((int) this.locX, (int) this.locY, (int) this.locZ), 0); } -@@ -500,7 +529,7 @@ - this.a(flag ? 0.5F : 1.0F); - } - -- protected final void setSize(float f, float f1) { -+ public final void setSize(float f, float f1) { // CraftBukkit - public - boolean flag = this.bp > 0.0F && this.bq > 0.0F; - - this.bp = f; -@@ -520,12 +549,16 @@ +@@ -514,12 +541,16 @@ } public void die(DamageSource damagesource) { - super.die(damagesource); + // super.die(damagesource); // CraftBukkit - if (damagesource.getEntity() instanceof EntityCreeper && !(this instanceof EntityPigZombie) && ((EntityCreeper) damagesource.getEntity()).isPowered() && ((EntityCreeper) damagesource.getEntity()).cp()) { - ((EntityCreeper) damagesource.getEntity()).cq(); + if (damagesource.getEntity() instanceof EntityCreeper && !(this instanceof EntityPigZombie) && ((EntityCreeper) damagesource.getEntity()).isPowered() && ((EntityCreeper) damagesource.getEntity()).canCauseHeadDrop()) { + ((EntityCreeper) damagesource.getEntity()).setCausedHeadDrop(); - this.a(new ItemStack(Items.SKULL, 1, 2), 0.0F); + // CraftBukkit start + // this.a(new ItemStack(Items.SKULL, 1, 2), 0.0F); -- cgit v1.2.3