mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-23 17:37:45 +01:00
SPIGOT-4571: EntityCombustEvent not firing for phantoms
This commit is contained in:
parent
9dc56581e6
commit
438556243d
@ -184,7 +184,7 @@
|
|||||||
|
|
||||||
this.av();
|
this.av();
|
||||||
this.r();
|
this.r();
|
||||||
@@ -337,7 +470,23 @@
|
@@ -337,12 +470,44 @@
|
||||||
|
|
||||||
protected void burnFromLava() {
|
protected void burnFromLava() {
|
||||||
if (!this.fireProof) {
|
if (!this.fireProof) {
|
||||||
@ -199,17 +199,38 @@
|
|||||||
+ this.world.getServer().getPluginManager().callEvent(combustEvent);
|
+ this.world.getServer().getPluginManager().callEvent(combustEvent);
|
||||||
+
|
+
|
||||||
+ if (!combustEvent.isCancelled()) {
|
+ if (!combustEvent.isCancelled()) {
|
||||||
+ this.setOnFire(combustEvent.getDuration());
|
+ this.setOnFire(combustEvent.getDuration(), false);
|
||||||
+ }
|
+ }
|
||||||
+ } else {
|
+ } else {
|
||||||
+ // This will be called every single tick the entity is in lava, so don't throw an event
|
+ // This will be called every single tick the entity is in lava, so don't throw an event
|
||||||
+ this.setOnFire(15);
|
+ this.setOnFire(15, false);
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end - we also don't throw an event unless the object in lava is living, to save on some event calls
|
+ // CraftBukkit end - we also don't throw an event unless the object in lava is living, to save on some event calls
|
||||||
this.damageEntity(DamageSource.LAVA, 4.0F);
|
this.damageEntity(DamageSource.LAVA, 4.0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -503,7 +652,7 @@
|
|
||||||
|
public void setOnFire(int i) {
|
||||||
|
+ // CraftBukkit start
|
||||||
|
+ this.setOnFire(i, true);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setOnFire(int i, boolean callEvent) {
|
||||||
|
+ if (callEvent) {
|
||||||
|
+ EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), i);
|
||||||
|
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
+
|
||||||
|
+ if (event.isCancelled()) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ i = event.getDuration();
|
||||||
|
+ }
|
||||||
|
+ // CraftBukkit end
|
||||||
|
int j = i * 20;
|
||||||
|
|
||||||
|
if (this instanceof EntityLiving) {
|
||||||
|
@@ -503,7 +668,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,7 +239,7 @@
|
|||||||
double d11;
|
double d11;
|
||||||
|
|
||||||
if (this.Q > 0.0F && flag && (d7 != d0 || d9 != d2)) {
|
if (this.Q > 0.0F && flag && (d7 != d0 || d9 != d2)) {
|
||||||
@@ -590,7 +739,7 @@
|
@@ -590,7 +755,7 @@
|
||||||
this.world.methodProfiler.enter("rest");
|
this.world.methodProfiler.enter("rest");
|
||||||
this.recalcPosition();
|
this.recalcPosition();
|
||||||
this.positionChanged = d7 != d0 || d9 != d2;
|
this.positionChanged = d7 != d0 || d9 != d2;
|
||||||
@ -227,7 +248,7 @@
|
|||||||
this.onGround = this.C && d8 < 0.0D;
|
this.onGround = this.C && d8 < 0.0D;
|
||||||
this.D = this.positionChanged || this.C;
|
this.D = this.positionChanged || this.C;
|
||||||
int k = MathHelper.floor(this.locX);
|
int k = MathHelper.floor(this.locX);
|
||||||
@@ -625,6 +774,28 @@
|
@@ -625,6 +790,28 @@
|
||||||
block1.a((IBlockAccess) this.world, this);
|
block1.a((IBlockAccess) this.world, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,7 +277,7 @@
|
|||||||
if (this.playStepSound() && (!this.onGround || !this.isSneaking() || !(this instanceof EntityHuman)) && !this.isPassenger()) {
|
if (this.playStepSound() && (!this.onGround || !this.isSneaking() || !(this instanceof EntityHuman)) && !this.isPassenger()) {
|
||||||
double d22 = this.locX - d4;
|
double d22 = this.locX - d4;
|
||||||
double d23 = this.locY - d5;
|
double d23 = this.locY - d5;
|
||||||
@@ -676,7 +847,14 @@
|
@@ -676,7 +863,14 @@
|
||||||
if (!flag1) {
|
if (!flag1) {
|
||||||
++this.fireTicks;
|
++this.fireTicks;
|
||||||
if (this.fireTicks == 0) {
|
if (this.fireTicks == 0) {
|
||||||
@ -272,7 +293,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -704,6 +882,7 @@
|
@@ -704,6 +898,7 @@
|
||||||
this.locX = (axisalignedbb.minX + axisalignedbb.maxX) / 2.0D;
|
this.locX = (axisalignedbb.minX + axisalignedbb.maxX) / 2.0D;
|
||||||
this.locY = axisalignedbb.minY;
|
this.locY = axisalignedbb.minY;
|
||||||
this.locZ = (axisalignedbb.minZ + axisalignedbb.maxZ) / 2.0D;
|
this.locZ = (axisalignedbb.minZ + axisalignedbb.maxZ) / 2.0D;
|
||||||
@ -280,7 +301,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected SoundEffect ad() {
|
protected SoundEffect ad() {
|
||||||
@@ -874,7 +1053,7 @@
|
@@ -874,7 +1069,7 @@
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,7 +310,7 @@
|
|||||||
if (!this.fireProof) {
|
if (!this.fireProof) {
|
||||||
this.damageEntity(DamageSource.FIRE, (float) i);
|
this.damageEntity(DamageSource.FIRE, (float) i);
|
||||||
}
|
}
|
||||||
@@ -1093,6 +1272,13 @@
|
@@ -1093,6 +1288,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void spawnIn(World world) {
|
public void spawnIn(World world) {
|
||||||
@ -303,7 +324,7 @@
|
|||||||
this.world = world;
|
this.world = world;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1118,6 +1304,7 @@
|
@@ -1118,6 +1320,7 @@
|
||||||
this.lastYaw -= 360.0F;
|
this.lastYaw -= 360.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +332,7 @@
|
|||||||
this.setPosition(this.locX, this.locY, this.locZ);
|
this.setPosition(this.locX, this.locY, this.locZ);
|
||||||
this.setYawPitch(f, f1);
|
this.setYawPitch(f, f1);
|
||||||
}
|
}
|
||||||
@@ -1300,7 +1487,7 @@
|
@@ -1300,7 +1503,7 @@
|
||||||
public boolean c(NBTTagCompound nbttagcompound) {
|
public boolean c(NBTTagCompound nbttagcompound) {
|
||||||
String s = this.getSaveID();
|
String s = this.getSaveID();
|
||||||
|
|
||||||
@ -320,7 +341,7 @@
|
|||||||
nbttagcompound.setString("id", s);
|
nbttagcompound.setString("id", s);
|
||||||
this.save(nbttagcompound);
|
this.save(nbttagcompound);
|
||||||
return true;
|
return true;
|
||||||
@@ -1317,6 +1504,18 @@
|
@@ -1317,6 +1520,18 @@
|
||||||
try {
|
try {
|
||||||
nbttagcompound.set("Pos", this.a(this.locX, this.locY, this.locZ));
|
nbttagcompound.set("Pos", this.a(this.locX, this.locY, this.locZ));
|
||||||
nbttagcompound.set("Motion", this.a(this.motX, this.motY, this.motZ));
|
nbttagcompound.set("Motion", this.a(this.motX, this.motY, this.motZ));
|
||||||
@ -339,7 +360,7 @@
|
|||||||
nbttagcompound.set("Rotation", this.a(this.yaw, this.pitch));
|
nbttagcompound.set("Rotation", this.a(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);
|
||||||
@@ -1326,6 +1525,12 @@
|
@@ -1326,6 +1541,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());
|
||||||
@ -352,7 +373,7 @@
|
|||||||
IChatBaseComponent ichatbasecomponent = this.getCustomName();
|
IChatBaseComponent ichatbasecomponent = this.getCustomName();
|
||||||
|
|
||||||
if (ichatbasecomponent != null) {
|
if (ichatbasecomponent != null) {
|
||||||
@@ -1402,6 +1607,8 @@
|
@@ -1402,6 +1623,8 @@
|
||||||
this.motX = nbttaglist1.k(0);
|
this.motX = nbttaglist1.k(0);
|
||||||
this.motY = nbttaglist1.k(1);
|
this.motY = nbttaglist1.k(1);
|
||||||
this.motZ = nbttaglist1.k(2);
|
this.motZ = nbttaglist1.k(2);
|
||||||
@ -361,7 +382,7 @@
|
|||||||
if (Math.abs(this.motX) > 10.0D) {
|
if (Math.abs(this.motX) > 10.0D) {
|
||||||
this.motX = 0.0D;
|
this.motX = 0.0D;
|
||||||
}
|
}
|
||||||
@@ -1413,6 +1620,7 @@
|
@@ -1413,6 +1636,7 @@
|
||||||
if (Math.abs(this.motZ) > 10.0D) {
|
if (Math.abs(this.motZ) > 10.0D) {
|
||||||
this.motZ = 0.0D;
|
this.motZ = 0.0D;
|
||||||
}
|
}
|
||||||
@ -369,7 +390,7 @@
|
|||||||
|
|
||||||
this.locX = nbttaglist.k(0);
|
this.locX = nbttaglist.k(0);
|
||||||
this.locY = nbttaglist.k(1);
|
this.locY = nbttaglist.k(1);
|
||||||
@@ -1469,6 +1677,56 @@
|
@@ -1469,6 +1693,56 @@
|
||||||
this.setPosition(this.locX, this.locY, this.locZ);
|
this.setPosition(this.locX, this.locY, this.locZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,7 +447,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");
|
||||||
@@ -1542,9 +1800,22 @@
|
@@ -1542,9 +1816,22 @@
|
||||||
if (itemstack.isEmpty()) {
|
if (itemstack.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
@ -449,7 +470,7 @@
|
|||||||
this.world.addEntity(entityitem);
|
this.world.addEntity(entityitem);
|
||||||
return entityitem;
|
return entityitem;
|
||||||
}
|
}
|
||||||
@@ -1656,7 +1927,7 @@
|
@@ -1656,7 +1943,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.vehicle = entity;
|
this.vehicle = entity;
|
||||||
@ -458,7 +479,7 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1677,15 +1948,33 @@
|
@@ -1677,15 +1964,33 @@
|
||||||
Entity entity = this.vehicle;
|
Entity entity = this.vehicle;
|
||||||
|
|
||||||
this.vehicle = null;
|
this.vehicle = null;
|
||||||
@ -494,7 +515,7 @@
|
|||||||
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bO() instanceof EntityHuman)) {
|
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bO() instanceof EntityHuman)) {
|
||||||
this.passengers.add(0, entity);
|
this.passengers.add(0, entity);
|
||||||
} else {
|
} else {
|
||||||
@@ -1693,15 +1982,33 @@
|
@@ -1693,15 +1998,33 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -529,7 +550,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean q(Entity entity) {
|
protected boolean q(Entity entity) {
|
||||||
@@ -1798,6 +2105,13 @@
|
@@ -1798,6 +2121,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSwimming(boolean flag) {
|
public void setSwimming(boolean flag) {
|
||||||
@ -543,7 +564,7 @@
|
|||||||
this.setFlag(4, flag);
|
this.setFlag(4, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1858,16 +2172,53 @@
|
@@ -1858,16 +2188,53 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAirTicks(int i) {
|
public void setAirTicks(int i) {
|
||||||
@ -600,7 +621,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void j(boolean flag) {
|
public void j(boolean flag) {
|
||||||
@@ -2034,19 +2385,72 @@
|
@@ -2034,19 +2401,72 @@
|
||||||
if (!this.world.isClientSide && !this.dead) {
|
if (!this.world.isClientSide && !this.dead) {
|
||||||
this.world.methodProfiler.enter("changeDimension");
|
this.world.methodProfiler.enter("changeDimension");
|
||||||
MinecraftServer minecraftserver = this.bK();
|
MinecraftServer minecraftserver = this.bK();
|
||||||
@ -676,7 +697,7 @@
|
|||||||
BlockPosition blockposition;
|
BlockPosition blockposition;
|
||||||
|
|
||||||
if (dimensionmanager == DimensionManager.THE_END) {
|
if (dimensionmanager == DimensionManager.THE_END) {
|
||||||
@@ -2075,12 +2479,18 @@
|
@@ -2075,12 +2495,18 @@
|
||||||
blockposition = new BlockPosition(this);
|
blockposition = new BlockPosition(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -696,7 +717,7 @@
|
|||||||
if (dimensionmanager1 == DimensionManager.THE_END && dimensionmanager == DimensionManager.THE_END) {
|
if (dimensionmanager1 == DimensionManager.THE_END && dimensionmanager == DimensionManager.THE_END) {
|
||||||
BlockPosition blockposition1 = worldserver1.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.getSpawn());
|
BlockPosition blockposition1 = worldserver1.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.getSpawn());
|
||||||
|
|
||||||
@@ -2088,6 +2498,7 @@
|
@@ -2088,6 +2514,7 @@
|
||||||
} else {
|
} else {
|
||||||
entity.setPositionRotation(blockposition, entity.yaw, entity.pitch);
|
entity.setPositionRotation(blockposition, entity.yaw, entity.pitch);
|
||||||
}
|
}
|
||||||
@ -704,7 +725,7 @@
|
|||||||
|
|
||||||
boolean flag = entity.attachedToPlayer;
|
boolean flag = entity.attachedToPlayer;
|
||||||
|
|
||||||
@@ -2095,13 +2506,21 @@
|
@@ -2095,13 +2522,21 @@
|
||||||
worldserver1.addEntity(entity);
|
worldserver1.addEntity(entity);
|
||||||
entity.attachedToPlayer = flag;
|
entity.attachedToPlayer = flag;
|
||||||
worldserver1.entityJoinedWorld(entity, false);
|
worldserver1.entityJoinedWorld(entity, false);
|
||||||
@ -727,7 +748,7 @@
|
|||||||
return entity;
|
return entity;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
@@ -2241,7 +2660,26 @@
|
@@ -2241,7 +2676,26 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(AxisAlignedBB axisalignedbb) {
|
public void a(AxisAlignedBB axisalignedbb) {
|
||||||
|
@ -1,20 +1,19 @@
|
|||||||
--- a/net/minecraft/server/EntityArrow.java
|
--- a/net/minecraft/server/EntityArrow.java
|
||||||
+++ b/net/minecraft/server/EntityArrow.java
|
+++ b/net/minecraft/server/EntityArrow.java
|
||||||
@@ -7,6 +7,13 @@
|
@@ -7,6 +7,12 @@
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
+// CraftBukkit start
|
+// CraftBukkit start
|
||||||
+import org.bukkit.entity.LivingEntity;
|
+import org.bukkit.entity.LivingEntity;
|
||||||
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
||||||
+import org.bukkit.event.entity.EntityCombustEvent;
|
|
||||||
+import org.bukkit.event.player.PlayerPickupArrowEvent;
|
+import org.bukkit.event.player.PlayerPickupArrowEvent;
|
||||||
+// CraftBukkit end
|
+// CraftBukkit end
|
||||||
+
|
+
|
||||||
public abstract class EntityArrow extends Entity implements IProjectile {
|
public abstract class EntityArrow extends Entity implements IProjectile {
|
||||||
|
|
||||||
private static final Predicate<Entity> g = IEntitySelector.f.and(IEntitySelector.a.and(Entity::isInteractable));
|
private static final Predicate<Entity> g = IEntitySelector.f.and(IEntitySelector.a.and(Entity::isInteractable));
|
||||||
@@ -22,7 +29,7 @@
|
@@ -22,7 +28,7 @@
|
||||||
public EntityArrow.PickupStatus fromPlayer;
|
public EntityArrow.PickupStatus fromPlayer;
|
||||||
public int shake;
|
public int shake;
|
||||||
public UUID shooter;
|
public UUID shooter;
|
||||||
@ -23,7 +22,7 @@
|
|||||||
private int aB;
|
private int aB;
|
||||||
private double damage;
|
private double damage;
|
||||||
public int knockbackStrength;
|
public int knockbackStrength;
|
||||||
@@ -250,6 +257,7 @@
|
@@ -250,6 +256,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void a(MovingObjectPosition movingobjectposition) {
|
protected void a(MovingObjectPosition movingobjectposition) {
|
||||||
@ -31,7 +30,7 @@
|
|||||||
if (movingobjectposition.entity != null) {
|
if (movingobjectposition.entity != null) {
|
||||||
this.b(movingobjectposition);
|
this.b(movingobjectposition);
|
||||||
} else {
|
} else {
|
||||||
@@ -299,7 +307,13 @@
|
@@ -299,7 +306,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isBurning() && !(entity instanceof EntityEnderman)) {
|
if (this.isBurning() && !(entity instanceof EntityEnderman)) {
|
||||||
@ -46,7 +45,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (entity.damageEntity(damagesource, (float) i)) {
|
if (entity.damageEntity(damagesource, (float) i)) {
|
||||||
@@ -444,6 +458,7 @@
|
@@ -444,6 +457,7 @@
|
||||||
|
|
||||||
public void setShooter(@Nullable Entity entity) {
|
public void setShooter(@Nullable Entity entity) {
|
||||||
this.shooter = entity == null ? null : entity.getUniqueID();
|
this.shooter = entity == null ? null : entity.getUniqueID();
|
||||||
@ -54,7 +53,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -453,9 +468,23 @@
|
@@ -453,9 +467,23 @@
|
||||||
|
|
||||||
public void d(EntityHuman entityhuman) {
|
public void d(EntityHuman entityhuman) {
|
||||||
if (!this.world.isClientSide && (this.inGround || this.q()) && this.shake <= 0) {
|
if (!this.world.isClientSide && (this.inGround || this.q()) && this.shake <= 0) {
|
||||||
@ -79,19 +78,3 @@
|
|||||||
flag = false;
|
flag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -528,7 +557,14 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
if (EnchantmentManager.a(Enchantments.ARROW_FIRE, entityliving) > 0) {
|
|
||||||
- this.setOnFire(100);
|
|
||||||
+ // CraftBukkit start - call EntityCombustEvent
|
|
||||||
+ EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 100);
|
|
||||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
|
||||||
+
|
|
||||||
+ if (!event.isCancelled()) {
|
|
||||||
+ this.setOnFire(event.getDuration());
|
|
||||||
+ }
|
|
||||||
+ // CraftBukkit end
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
@ -1,30 +1,6 @@
|
|||||||
--- a/net/minecraft/server/EntitySkeletonAbstract.java
|
--- a/net/minecraft/server/EntitySkeletonAbstract.java
|
||||||
+++ b/net/minecraft/server/EntitySkeletonAbstract.java
|
+++ b/net/minecraft/server/EntitySkeletonAbstract.java
|
||||||
@@ -3,6 +3,7 @@
|
@@ -151,8 +151,19 @@
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.temporal.ChronoField;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
+import org.bukkit.event.entity.EntityCombustEvent; // CraftBukkit
|
|
||||||
|
|
||||||
public abstract class EntitySkeletonAbstract extends EntityMonster implements IRangedEntity {
|
|
||||||
|
|
||||||
@@ -78,7 +79,14 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flag) {
|
|
||||||
- this.setOnFire(8);
|
|
||||||
+ // CraftBukkit start
|
|
||||||
+ EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
|
|
||||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
|
||||||
+
|
|
||||||
+ if (!event.isCancelled()) {
|
|
||||||
+ this.setOnFire(event.getDuration());
|
|
||||||
+ }
|
|
||||||
+ // CraftBukkit end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -151,8 +159,19 @@
|
|
||||||
double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
|
double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
|
||||||
|
|
||||||
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.world.getDifficulty().a() * 4));
|
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.world.getDifficulty().a() * 4));
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/server/EntityZombie.java
|
--- a/net/minecraft/server/EntityZombie.java
|
||||||
+++ b/net/minecraft/server/EntityZombie.java
|
+++ b/net/minecraft/server/EntityZombie.java
|
||||||
@@ -6,6 +6,15 @@
|
@@ -6,6 +6,14 @@
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
@ -8,7 +8,6 @@
|
|||||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
||||||
+import org.bukkit.event.entity.EntityCombustEvent;
|
|
||||||
+import org.bukkit.event.entity.EntityTargetEvent;
|
+import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
+import org.bukkit.event.entity.EntityTransformEvent;
|
+import org.bukkit.event.entity.EntityTransformEvent;
|
||||||
+// CraftBukkit end
|
+// CraftBukkit end
|
||||||
@ -16,7 +15,7 @@
|
|||||||
public class EntityZombie extends EntityMonster {
|
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");
|
protected static final IAttribute c = (new AttributeRanged((IAttribute) null, "zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance");
|
||||||
@@ -21,6 +30,7 @@
|
@@ -21,6 +29,7 @@
|
||||||
public int drownedConversionTime;
|
public int drownedConversionTime;
|
||||||
private float bK;
|
private float bK;
|
||||||
private float bL;
|
private float bL;
|
||||||
@ -24,7 +23,7 @@
|
|||||||
|
|
||||||
public EntityZombie(EntityTypes<?> entitytypes, World world) {
|
public EntityZombie(EntityTypes<?> entitytypes, World world) {
|
||||||
super(entitytypes, world);
|
super(entitytypes, world);
|
||||||
@@ -143,8 +153,12 @@
|
@@ -143,8 +152,12 @@
|
||||||
|
|
||||||
public void tick() {
|
public void tick() {
|
||||||
if (!this.world.isClientSide) {
|
if (!this.world.isClientSide) {
|
||||||
@ -39,23 +38,7 @@
|
|||||||
if (this.drownedConversionTime < 0) {
|
if (this.drownedConversionTime < 0) {
|
||||||
this.dE();
|
this.dE();
|
||||||
}
|
}
|
||||||
@@ -182,7 +196,14 @@
|
@@ -221,7 +234,12 @@
|
||||||
}
|
|
||||||
|
|
||||||
if (flag) {
|
|
||||||
- this.setOnFire(8);
|
|
||||||
+ // CraftBukkit start
|
|
||||||
+ EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
|
|
||||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
|
||||||
+
|
|
||||||
+ if (!event.isCancelled()) {
|
|
||||||
+ this.setOnFire(event.getDuration());
|
|
||||||
+ }
|
|
||||||
+ // CraftBukkit end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -221,7 +242,12 @@
|
|
||||||
entityzombie.setCustomNameVisible(this.getCustomNameVisible());
|
entityzombie.setCustomNameVisible(this.getCustomNameVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +52,7 @@
|
|||||||
this.die();
|
this.die();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -252,8 +278,8 @@
|
@@ -252,8 +270,8 @@
|
||||||
if (this.world.getType(new BlockPosition(i1, j1 - 1, k1)).q() && this.world.getLightLevel(new BlockPosition(i1, j1, k1)) < 10) {
|
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);
|
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())) {
|
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())) {
|
||||||
@ -80,7 +63,7 @@
|
|||||||
entityzombie.prepare(this.world.getDamageScaler(new BlockPosition(entityzombie)), (GroupDataEntity) null, (NBTTagCompound) null);
|
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));
|
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));
|
entityzombie.getAttributeInstance(EntityZombie.c).b(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0));
|
||||||
@@ -276,7 +302,14 @@
|
@@ -276,7 +294,14 @@
|
||||||
float f = this.world.getDamageScaler(new BlockPosition(this)).b();
|
float f = this.world.getDamageScaler(new BlockPosition(this)).b();
|
||||||
|
|
||||||
if (this.getItemInMainHand().isEmpty() && this.isBurning() && this.random.nextFloat() < f * 0.3F) {
|
if (this.getItemInMainHand().isEmpty() && this.isBurning() && this.random.nextFloat() < f * 0.3F) {
|
||||||
@ -96,7 +79,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,7 +395,7 @@
|
@@ -362,7 +387,7 @@
|
||||||
EntityZombieVillager entityzombievillager = new EntityZombieVillager(this.world);
|
EntityZombieVillager entityzombievillager = new EntityZombieVillager(this.world);
|
||||||
|
|
||||||
entityzombievillager.u(entityvillager);
|
entityzombievillager.u(entityvillager);
|
||||||
@ -105,7 +88,7 @@
|
|||||||
entityzombievillager.prepare(this.world.getDamageScaler(new BlockPosition(entityzombievillager)), new EntityZombie.GroupDataZombie(false), (NBTTagCompound) null);
|
entityzombievillager.prepare(this.world.getDamageScaler(new BlockPosition(entityzombievillager)), new EntityZombie.GroupDataZombie(false), (NBTTagCompound) null);
|
||||||
entityzombievillager.setProfession(entityvillager.getProfession());
|
entityzombievillager.setProfession(entityvillager.getProfession());
|
||||||
entityzombievillager.setBaby(entityvillager.isBaby());
|
entityzombievillager.setBaby(entityvillager.isBaby());
|
||||||
@@ -372,7 +405,13 @@
|
@@ -372,7 +397,13 @@
|
||||||
entityzombievillager.setCustomNameVisible(entityvillager.getCustomNameVisible());
|
entityzombievillager.setCustomNameVisible(entityvillager.getCustomNameVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +103,7 @@
|
|||||||
this.world.a((EntityHuman) null, 1026, new BlockPosition(this), 0);
|
this.world.a((EntityHuman) null, 1026, new BlockPosition(this), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -422,7 +461,7 @@
|
@@ -422,7 +453,7 @@
|
||||||
entitychicken1.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
|
entitychicken1.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
|
||||||
entitychicken1.prepare(difficultydamagescaler, (GroupDataEntity) null, (NBTTagCompound) null);
|
entitychicken1.prepare(difficultydamagescaler, (GroupDataEntity) null, (NBTTagCompound) null);
|
||||||
entitychicken1.s(true);
|
entitychicken1.s(true);
|
||||||
@ -129,7 +112,7 @@
|
|||||||
this.startRiding(entitychicken1);
|
this.startRiding(entitychicken1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -495,7 +534,7 @@
|
@@ -495,7 +526,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void die(DamageSource damagesource) {
|
public void die(DamageSource damagesource) {
|
||||||
@ -138,7 +121,7 @@
|
|||||||
if (damagesource.getEntity() instanceof EntityCreeper) {
|
if (damagesource.getEntity() instanceof EntityCreeper) {
|
||||||
EntityCreeper entitycreeper = (EntityCreeper) damagesource.getEntity();
|
EntityCreeper entitycreeper = (EntityCreeper) damagesource.getEntity();
|
||||||
|
|
||||||
@@ -508,6 +547,7 @@
|
@@ -508,6 +539,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
--- a/net/minecraft/server/ItemBow.java
|
--- a/net/minecraft/server/ItemBow.java
|
||||||
+++ b/net/minecraft/server/ItemBow.java
|
+++ b/net/minecraft/server/ItemBow.java
|
||||||
@@ -1,15 +1,21 @@
|
@@ -4,12 +4,16 @@
|
||||||
package net.minecraft.server;
|
|
||||||
|
|
||||||
+import org.bukkit.event.entity.EntityCombustEvent; // CraftBukkit
|
|
||||||
+
|
|
||||||
public class ItemBow extends Item {
|
|
||||||
|
|
||||||
public ItemBow(Item.Info item_info) {
|
public ItemBow(Item.Info item_info) {
|
||||||
super(item_info);
|
super(item_info);
|
||||||
@ -22,33 +17,25 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ItemStack a(EntityHuman entityhuman) {
|
private ItemStack a(EntityHuman entityhuman) {
|
||||||
@@ -73,7 +79,20 @@
|
@@ -75,13 +79,29 @@
|
||||||
}
|
|
||||||
|
|
||||||
if (EnchantmentManager.getEnchantmentLevel(Enchantments.ARROW_FIRE, itemstack) > 0) {
|
if (EnchantmentManager.getEnchantmentLevel(Enchantments.ARROW_FIRE, itemstack) > 0) {
|
||||||
- entityarrow.setOnFire(100);
|
entityarrow.setOnFire(100);
|
||||||
+ // CraftBukkit start - call EntityCombustEvent
|
}
|
||||||
+ EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100);
|
|
||||||
+ entityarrow.world.getServer().getPluginManager().callEvent(event);
|
|
||||||
+
|
|
||||||
+ if (!event.isCancelled()) {
|
|
||||||
+ entityarrow.setOnFire(event.getDuration());
|
|
||||||
+ }
|
|
||||||
+ // CraftBukkit end
|
|
||||||
+ }
|
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityhuman, itemstack, entityarrow, f);
|
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityhuman, itemstack, entityarrow, f);
|
||||||
+ if (event.isCancelled()) {
|
+ if (event.isCancelled()) {
|
||||||
+ event.getProjectile().remove();
|
+ event.getProjectile().remove();
|
||||||
+ return;
|
+ return;
|
||||||
}
|
+ }
|
||||||
|
+ // CraftBukkit end
|
||||||
|
|
||||||
itemstack.damage(1, entityhuman);
|
itemstack.damage(1, entityhuman);
|
||||||
@@ -81,7 +100,15 @@
|
if (flag1 || entityhuman.abilities.canInstantlyBuild && (itemstack1.getItem() == Items.SPECTRAL_ARROW || itemstack1.getItem() == Items.TIPPED_ARROW)) {
|
||||||
entityarrow.fromPlayer = EntityArrow.PickupStatus.CREATIVE_ONLY;
|
entityarrow.fromPlayer = EntityArrow.PickupStatus.CREATIVE_ONLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
- world.addEntity(entityarrow);
|
- world.addEntity(entityarrow);
|
||||||
|
+ // CraftBukkit start
|
||||||
+ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
|
+ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
|
||||||
+ if (!world.addEntity(entityarrow)) {
|
+ if (!world.addEntity(entityarrow)) {
|
||||||
+ if (entityhuman instanceof EntityPlayer) {
|
+ if (entityhuman instanceof EntityPlayer) {
|
||||||
|
Loading…
Reference in New Issue
Block a user