From 604c8bf07e962b3cf83c111661b9118e690e2fd2 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 3 Jul 2019 11:10:51 +1000 Subject: [PATCH] SPIGOT-3102: Add EXPLOSION SpawnReason --- nms-patches/EntityCreeper.patch | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/nms-patches/EntityCreeper.patch b/nms-patches/EntityCreeper.patch index f05581495f..75bd57ef46 100644 --- a/nms-patches/EntityCreeper.patch +++ b/nms-patches/EntityCreeper.patch @@ -1,17 +1,18 @@ --- a/net/minecraft/server/EntityCreeper.java +++ b/net/minecraft/server/EntityCreeper.java -@@ -2,6 +2,10 @@ +@@ -2,6 +2,11 @@ import java.util.Collection; import java.util.Iterator; +// CraftBukkit start +import org.bukkit.craftbukkit.event.CraftEventFactory; ++import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.ExplosionPrimeEvent; +// CraftBukkit end public class EntityCreeper extends EntityMonster { -@@ -165,9 +169,19 @@ +@@ -165,9 +170,19 @@ @Override public void onLightningStrike(EntityLightning entitylightning) { super.onLightningStrike(entitylightning); @@ -32,7 +33,7 @@ @Override protected boolean a(EntityHuman entityhuman, EnumHand enumhand) { ItemStack itemstack = entityhuman.b(enumhand); -@@ -192,10 +206,18 @@ +@@ -192,10 +207,18 @@ Explosion.Effect explosion_effect = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE; float f = this.isPowered() ? 2.0F : 1.0F; @@ -55,7 +56,7 @@ } } -@@ -206,6 +228,7 @@ +@@ -206,6 +229,7 @@ if (!collection.isEmpty()) { EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.world, this.locX, this.locY, this.locZ); @@ -63,3 +64,12 @@ entityareaeffectcloud.setRadius(2.5F); entityareaeffectcloud.setRadiusOnUse(-0.5F); entityareaeffectcloud.setWaitTime(10); +@@ -219,7 +243,7 @@ + entityareaeffectcloud.a(new MobEffect(mobeffect)); + } + +- this.world.addEntity(entityareaeffectcloud); ++ this.world.addEntity(entityareaeffectcloud, CreatureSpawnEvent.SpawnReason.EXPLOSION); // CraftBukkit + } + + }