Add list of entities to EntityTransformEvent & move die calls
By: nathat890 <nathat890@outlook.com>
This commit is contained in:
@@ -28,31 +28,18 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -149,6 +155,12 @@
|
||||
if (!this.world.isClientSide && !this.dead) {
|
||||
EntityPigZombie entitypigzombie = new EntityPigZombie(this.world);
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
entitypigzombie.setSlot(EnumItemSlot.MAINHAND, new ItemStack(Items.GOLDEN_SWORD));
|
||||
entitypigzombie.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
|
||||
entitypigzombie.setNoAI(this.isNoAI());
|
||||
@@ -157,7 +169,13 @@
|
||||
@@ -157,7 +163,13 @@
|
||||
entitypigzombie.setCustomNameVisible(this.getCustomNameVisible());
|
||||
}
|
||||
|
||||
- this.world.addEntity(entitypigzombie);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, entitypigzombie, EntityTransformEvent.TransformReason.LIGHTNING).isCancelled()) {
|
||||
+ if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ // CraftBukkit - added a reason for spawning this creature
|
||||
+ this.world.addEntity(entitypigzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
|
||||
+ // CraftBukkit end
|
||||
this.die();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user