Add some missing CreatureSpawnEvent.SpawnReason calls

Dieser Commit ist enthalten in:
md_5 2018-11-14 14:17:25 +11:00
Ursprung d2c422f13e
Commit c2035aa1d0
3 geänderte Dateien mit 14 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -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)));

Datei anzeigen

@ -73,15 +73,17 @@
}
}
@@ -574,6 +604,11 @@
@@ -574,7 +604,12 @@
entitywitch.setCustomNameVisible(this.getCustomNameVisible());
}
- this.world.addEntity(entitywitch);
+ // CraftBukkit start
+ if (CraftEventFactory.callEntityTransformEvent(this, entitywitch, EntityTransformEvent.TransformReason.LIGHTNING).isCancelled()) {
+ return;
+ }
+ this.world.addEntity(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
+ // CraftBukkit end
this.world.addEntity(entitywitch);
this.die();
}
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/Village.java
+++ b/net/minecraft/server/Village.java
@@ -73,7 +73,7 @@
@@ -73,11 +73,11 @@
BlockPosition blockposition1 = blockposition.a(this.a.random.nextInt(16) - 8, this.a.random.nextInt(6) - 3, this.a.random.nextInt(16) - 8);
if (this.a(blockposition1)) {
@ -9,3 +9,8 @@
if (entityirongolem != null) {
if (entityirongolem.a((GeneratorAccess) this.a, false) && entityirongolem.a((IWorldReader) this.a)) {
- this.a.addEntity(entityirongolem);
+ this.a.addEntity(entityirongolem, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE); // CraftBukkit
return entityirongolem;
}