SPIGOT-3102: Add EXPLOSION SpawnReason

This commit is contained in:
md_5 2019-07-03 11:10:51 +10:00
parent 375969a674
commit 604c8bf07e

View File

@ -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
}
}