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

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-08-22 18:07:31 +10:00
parent 9c5dd3b837
commit 00c0964347

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) {