13
0
geforkt von Mirrors/Paper

SPIGOT-2653: Better align combustion with vanilla behaviour

Dieser Commit ist enthalten in:
md_5 2016-09-03 16:39:21 +10:00
Ursprung 4d87c3422c
Commit fafcfd7529

Datei anzeigen

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