SPIGOT-4571: EntityCombustEvent not firing for phantoms

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2019-01-09 20:38:37 +11:00
parent 5a915978fa
commit ab7419bd7d
5 changed files with 75 additions and 125 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityZombie.java
+++ b/net/minecraft/server/EntityZombie.java
@@ -6,6 +6,15 @@
@@ -6,6 +6,14 @@
import java.util.UUID;
import javax.annotation.Nullable;
@@ -8,7 +8,6 @@
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.CreatureSpawnEvent;
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
+import org.bukkit.event.entity.EntityCombustEvent;
+import org.bukkit.event.entity.EntityTargetEvent;
+import org.bukkit.event.entity.EntityTransformEvent;
+// CraftBukkit end
@@ -16,7 +15,7 @@
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");
@@ -21,6 +30,7 @@
@@ -21,6 +29,7 @@
public int drownedConversionTime;
private float bK;
private float bL;
@@ -24,7 +23,7 @@
public EntityZombie(EntityTypes<?> entitytypes, World world) {
super(entitytypes, world);
@@ -143,8 +153,12 @@
@@ -143,8 +152,12 @@
public void tick() {
if (!this.world.isClientSide) {
@@ -39,23 +38,7 @@
if (this.drownedConversionTime < 0) {
this.dE();
}
@@ -182,7 +196,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
}
}
@@ -221,7 +242,12 @@
@@ -221,7 +234,12 @@
entityzombie.setCustomNameVisible(this.getCustomNameVisible());
}
@@ -69,7 +52,7 @@
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) {
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())) {
@@ -80,7 +63,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 +302,14 @@
@@ -276,7 +294,14 @@
float f = this.world.getDamageScaler(new BlockPosition(this)).b();
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.u(entityvillager);
@@ -105,7 +88,7 @@
entityzombievillager.prepare(this.world.getDamageScaler(new BlockPosition(entityzombievillager)), new EntityZombie.GroupDataZombie(false), (NBTTagCompound) null);
entityzombievillager.setProfession(entityvillager.getProfession());
entityzombievillager.setBaby(entityvillager.isBaby());
@@ -372,7 +405,13 @@
@@ -372,7 +397,13 @@
entityzombievillager.setCustomNameVisible(entityvillager.getCustomNameVisible());
}
@@ -120,7 +103,7 @@
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.prepare(difficultydamagescaler, (GroupDataEntity) null, (NBTTagCompound) null);
entitychicken1.s(true);
@@ -129,7 +112,7 @@
this.startRiding(entitychicken1);
}
}
@@ -495,7 +534,7 @@
@@ -495,7 +526,7 @@
}
public void die(DamageSource damagesource) {
@@ -138,7 +121,7 @@
if (damagesource.getEntity() instanceof EntityCreeper) {
EntityCreeper entitycreeper = (EntityCreeper) damagesource.getEntity();
@@ -508,6 +547,7 @@
@@ -508,6 +539,7 @@
}
}
}