Add some missing CreatureSpawnEvent.SpawnReason calls

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2018-11-14 14:17:25 +11:00
parent 6fd5f1379b
commit d625045ee2
3 changed files with 14 additions and 5 deletions

View File

@@ -28,15 +28,17 @@
this.world.addParticle(Particles.u, this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, 0.0D, 0.0D, 0.0D);
if (!this.world.isClientSide) {
this.die();
@@ -35,6 +49,11 @@
@@ -35,7 +49,12 @@
entitycow.setCustomName(this.getCustomName());
}
- this.world.addEntity(entitycow);
+ // CraftBukkit start
+ if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) {
+ return false;
+ }
+ this.world.addEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
+ // CraftBukkit end
this.world.addEntity(entitycow);
for (int i = 0; i < 5; ++i) {
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY + (double) this.length, this.locZ, new ItemStack(Blocks.RED_MUSHROOM)));