Add list of entities to EntityTransformEvent & move die calls

By: nathat890 <nathat890@outlook.com>
This commit is contained in:
CraftBukkit/Spigot
2018-12-05 09:51:20 +11:00
parent b69f1de549
commit e9e6bec4e5
6 changed files with 72 additions and 39 deletions

View File

@@ -96,7 +96,16 @@
}
}
@@ -372,7 +405,12 @@
@@ -362,7 +395,7 @@
EntityZombieVillager entityzombievillager = new EntityZombieVillager(this.world);
entityzombievillager.u(entityvillager);
- this.world.kill(entityvillager);
+ // this.world.kill(entityvillager); // CraftBukkit - moved down
entityzombievillager.prepare(this.world.getDamageScaler(new BlockPosition(entityzombievillager)), new EntityZombie.GroupDataZombie(false, null), (NBTTagCompound) null);
entityzombievillager.setProfession(entityvillager.getProfession());
entityzombievillager.setBaby(entityvillager.isBaby());
@@ -372,7 +405,13 @@
entityzombievillager.setCustomNameVisible(entityvillager.getCustomNameVisible());
}
@@ -105,12 +114,13 @@
+ if (CraftEventFactory.callEntityTransformEvent(this, entityzombievillager, EntityTransformEvent.TransformReason.INFECTION).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
+ this.world.kill(entityvillager); // CraftBukkit - from above
+ this.world.addEntity(entityzombievillager, CreatureSpawnEvent.SpawnReason.INFECTION); // CraftBukkit - add SpawnReason
+ // CraftBukkit end
this.world.a((EntityHuman) null, 1026, new BlockPosition(this), 0);
}
@@ -422,7 +460,7 @@
@@ -422,7 +461,7 @@
entitychicken1.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
entitychicken1.prepare(difficultydamagescaler, (GroupDataEntity) null, (NBTTagCompound) null);
entitychicken1.s(true);
@@ -119,7 +129,7 @@
this.startRiding(entitychicken1);
}
}
@@ -495,7 +533,7 @@
@@ -495,7 +534,7 @@
}
public void die(DamageSource damagesource) {
@@ -128,7 +138,7 @@
if (damagesource.getEntity() instanceof EntityCreeper) {
EntityCreeper entitycreeper = (EntityCreeper) damagesource.getEntity();
@@ -508,6 +546,7 @@
@@ -508,6 +547,7 @@
}
}
}