From fafcfd7529eccb7a23d125c06cdbda836a8f004c Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 3 Sep 2016 16:39:21 +1000 Subject: [PATCH] SPIGOT-2653: Better align combustion with vanilla behaviour --- nms-patches/Entity.patch | 50 +++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/nms-patches/Entity.patch b/nms-patches/Entity.patch index 48bb5bac99..317706ad61 100644 --- a/nms-patches/Entity.patch +++ b/nms-patches/Entity.patch @@ -198,25 +198,23 @@ boolean flag2 = this.ai(); -@@ -634,7 +765,16 @@ - this.burn(1); +@@ -635,7 +766,14 @@ if (!flag2) { ++this.fireTicks; -- if (this.fireTicks == 0) { -+ // CraftBukkit start - Not on fire yet -+ if (this.fireTicks <= 0) { // Only throw events on the first combust, otherwise it spams + if (this.fireTicks == 0) { +- this.setOnFire(8); ++ // CraftBukkit start + EntityCombustEvent event = new org.bukkit.event.entity.EntityCombustByBlockEvent(null, getBukkitEntity(), 8); + world.getServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) { -+ setOnFire(event.getDuration()); ++ this.setOnFire(event.getDuration()); + } -+ } else { + // CraftBukkit end - this.setOnFire(8); } } -@@ -756,7 +896,7 @@ + } else if (this.fireTicks <= 0) { +@@ -756,7 +894,7 @@ return null; } @@ -225,7 +223,7 @@ if (!this.fireProof) { this.damageEntity(DamageSource.FIRE, (float) i); } -@@ -922,6 +1062,13 @@ +@@ -922,6 +1060,13 @@ } public void spawnIn(World world) { @@ -239,7 +237,7 @@ this.world = world; } -@@ -1126,6 +1273,18 @@ +@@ -1126,6 +1271,18 @@ try { nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY, this.locZ})); nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ})); @@ -258,7 +256,7 @@ nbttagcompound.set("Rotation", this.a(new float[] { this.yaw, this.pitch})); nbttagcompound.setFloat("FallDistance", this.fallDistance); nbttagcompound.setShort("Fire", (short) this.fireTicks); -@@ -1135,6 +1294,12 @@ +@@ -1135,6 +1292,12 @@ nbttagcompound.setBoolean("Invulnerable", this.invulnerable); nbttagcompound.setInt("PortalCooldown", this.portalCooldown); nbttagcompound.a("UUID", this.getUniqueID()); @@ -271,7 +269,7 @@ if (this.getCustomName() != null && !this.getCustomName().isEmpty()) { nbttagcompound.setString("CustomName", this.getCustomName()); } -@@ -1210,6 +1375,8 @@ +@@ -1210,6 +1373,8 @@ this.motX = nbttaglist1.e(0); this.motY = nbttaglist1.e(1); this.motZ = nbttaglist1.e(2); @@ -280,7 +278,7 @@ if (Math.abs(this.motX) > 10.0D) { this.motX = 0.0D; } -@@ -1221,6 +1388,7 @@ +@@ -1221,6 +1386,7 @@ if (Math.abs(this.motZ) > 10.0D) { this.motZ = 0.0D; } @@ -288,7 +286,7 @@ this.locX = nbttaglist.e(0); this.locY = nbttaglist.e(1); -@@ -1278,6 +1446,58 @@ +@@ -1278,6 +1444,58 @@ this.setPosition(this.locX, this.locY, this.locZ); } @@ -347,7 +345,7 @@ } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded"); -@@ -1337,6 +1557,12 @@ +@@ -1337,6 +1555,12 @@ public EntityItem a(ItemStack itemstack, float f) { if (itemstack.count != 0 && itemstack.getItem() != null) { @@ -360,7 +358,7 @@ EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY + (double) f, this.locZ, itemstack); entityitem.q(); -@@ -1458,6 +1684,24 @@ +@@ -1458,6 +1682,24 @@ if (entity.bB() != this) { throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)"); } else { @@ -385,7 +383,7 @@ if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bw() instanceof EntityHuman)) { this.passengers.add(0, entity); } else { -@@ -1471,6 +1715,22 @@ +@@ -1471,6 +1713,22 @@ if (entity.bB() == this) { throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); } else { @@ -408,7 +406,7 @@ this.passengers.remove(entity); entity.j = 60; } -@@ -1610,14 +1870,48 @@ +@@ -1610,14 +1868,48 @@ } public void setAirTicks(int i) { @@ -460,7 +458,7 @@ } } -@@ -1752,19 +2046,67 @@ +@@ -1752,19 +2044,67 @@ if (!this.world.isClientSide && !this.dead) { this.world.methodProfiler.a("changeDimension"); MinecraftServer minecraftserver = this.h(); @@ -531,7 +529,7 @@ BlockPosition blockposition; if (i == 1) { -@@ -1793,12 +2135,18 @@ +@@ -1793,12 +2133,18 @@ blockposition = new BlockPosition(this); } @@ -551,7 +549,7 @@ if (j == 1 && i == 1) { BlockPosition blockposition1 = worldserver1.q(worldserver1.getSpawn()); -@@ -1806,6 +2154,7 @@ +@@ -1806,6 +2152,7 @@ } else { entity.setPositionRotation(blockposition, entity.yaw, entity.pitch); } @@ -559,7 +557,7 @@ boolean flag = entity.attachedToPlayer; -@@ -1813,6 +2162,14 @@ +@@ -1813,6 +2160,14 @@ worldserver1.addEntity(entity); entity.attachedToPlayer = flag; worldserver1.entityJoinedWorld(entity, false); @@ -574,7 +572,7 @@ } this.dead = true; -@@ -1923,6 +2280,11 @@ +@@ -1923,6 +2278,11 @@ } public void setCustomName(String s) { @@ -586,7 +584,7 @@ this.datawatcher.set(Entity.aA, s); } -@@ -1980,7 +2342,26 @@ +@@ -1980,7 +2340,26 @@ } public void a(AxisAlignedBB axisalignedbb) { @@ -614,7 +612,7 @@ } public float getHeadHeight() { -@@ -2154,7 +2535,7 @@ +@@ -2154,7 +2533,7 @@ for (Iterator iterator = this.bx().iterator(); iterator.hasNext(); entity.a(oclass, set)) { entity = (Entity) iterator.next(); if (oclass.isAssignableFrom(entity.getClass())) {