SPIGOT-6713: Cancelling EntityTransformEvent Causes Deceased Slimes To Not Despawn

This commit is contained in:
md_5 2021-08-22 18:07:31 +10:00
parent 7c8bbcbee7
commit c949675e1f
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -44,7 +44,7 @@
for (int l = 0; l < k; ++l) { for (int l = 0; l < k; ++l) {
float f1 = ((float) (l % 2) - 0.5F) * f; float f1 = ((float) (l % 2) - 0.5F) * f;
float f2 = ((float) (l / 2) - 0.5F) * f; float f2 = ((float) (l / 2) - 0.5F) * f;
@@ -214,8 +235,17 @@ @@ -214,8 +235,18 @@
entityslime.setInvulnerable(this.isInvulnerable()); entityslime.setInvulnerable(this.isInvulnerable());
entityslime.setSize(j, true); entityslime.setSize(j, true);
entityslime.setPositionRotation(this.locX() + (double) f1, this.locY() + 0.5D, this.locZ() + (double) f2, this.random.nextFloat() * 360.0F, 0.0F); entityslime.setPositionRotation(this.locX() + (double) f1, this.locY() + 0.5D, this.locZ() + (double) f2, this.random.nextFloat() * 360.0F, 0.0F);
@ -54,6 +54,7 @@
+ +
+ // CraftBukkit start + // CraftBukkit start
+ if (CraftEventFactory.callEntityTransformEvent(this, slimes, EntityTransformEvent.TransformReason.SPLIT).isCancelled()) { + if (CraftEventFactory.callEntityTransformEvent(this, slimes, EntityTransformEvent.TransformReason.SPLIT).isCancelled()) {
+ super.a(entity_removalreason);
+ return; + return;
+ } + }
+ for (EntityLiving living : slimes) { + for (EntityLiving living : slimes) {