PaperMC/paper-server/nms-patches/net/minecraft/world/entity/projectile/EntityWitherSkull.patch
CraftBukkit/Spigot 43702a9e10 Update to Minecraft 1.18-pre5
By: md_5 <git@md-5.net>
2021-11-22 09:00:00 +11:00

46 lines
2.3 KiB
Diff

--- a/net/minecraft/world/entity/projectile/EntityWitherSkull.java
+++ b/net/minecraft/world/entity/projectile/EntityWitherSkull.java
@@ -21,6 +21,8 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.MovingObjectPositionEntity;
+import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
+
public class EntityWitherSkull extends EntityFireball {
private static final DataWatcherObject<Boolean> DATA_DANGEROUS = DataWatcher.defineId(EntityWitherSkull.class, DataWatcherRegistry.BOOLEAN);
@@ -64,7 +66,7 @@
if (entity.isAlive()) {
this.doEnchantDamageEffects(entityliving, entity);
} else {
- entityliving.heal(5.0F);
+ entityliving.heal(5.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit
}
}
} else {
@@ -81,7 +83,7 @@
}
if (b0 > 0) {
- ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.WITHER, 20 * b0, 1), this.getEffectSource());
+ ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.WITHER, 20 * b0, 1), this.getEffectSource(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
}
}
@@ -94,7 +96,15 @@
if (!this.level.isClientSide) {
Explosion.Effect explosion_effect = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
- this.level.explode(this, this.getX(), this.getY(), this.getZ(), 1.0F, false, explosion_effect);
+ // CraftBukkit start
+ // this.level.createExplosion(this, this.locX(), this.locY(), this.locZ(), 1.0F, false, explosion_effect);
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 1.0F, false);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), explosion_effect);
+ }
+ // CraftBukkit end
this.discard();
}