mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 12:02:36 +01:00
eed041d629
By: md_5 <git@md-5.net>
51 lines
2.4 KiB
Diff
51 lines
2.4 KiB
Diff
--- a/net/minecraft/world/entity/projectile/EntityWitherSkull.java
|
|
+++ b/net/minecraft/world/entity/projectile/EntityWitherSkull.java
|
|
@@ -24,6 +24,11 @@
|
|
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
|
import net.minecraft.world.phys.Vec3D;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.event.entity.EntityRemoveEvent;
|
|
+import org.bukkit.event.entity.ExplosionPrimeEvent;
|
|
+// CraftBukkit end
|
|
+
|
|
public class EntityWitherSkull extends EntityFireball {
|
|
|
|
private static final DataWatcherObject<Boolean> DATA_DANGEROUS = DataWatcher.defineId(EntityWitherSkull.class, DataWatcherRegistry.BOOLEAN);
|
|
@@ -69,7 +74,7 @@
|
|
if (entity.isAlive()) {
|
|
EnchantmentManager.doPostAttackEffects(worldserver, entity, damagesource);
|
|
} else {
|
|
- entityliving.heal(5.0F);
|
|
+ entityliving.heal(5.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit
|
|
}
|
|
}
|
|
} else {
|
|
@@ -86,7 +91,7 @@
|
|
}
|
|
|
|
if (b0 > 0) {
|
|
- entityliving.addEffect(new MobEffect(MobEffects.WITHER, 20 * b0, 1), this.getEffectSource());
|
|
+ entityliving.addEffect(new MobEffect(MobEffects.WITHER, 20 * b0, 1), this.getEffectSource(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
|
}
|
|
}
|
|
|
|
@@ -97,8 +102,16 @@
|
|
protected void onHit(MovingObjectPosition movingobjectposition) {
|
|
super.onHit(movingobjectposition);
|
|
if (!this.level().isClientSide) {
|
|
- this.level().explode(this, this.getX(), this.getY(), this.getZ(), 1.0F, false, World.a.MOB);
|
|
- this.discard();
|
|
+ // CraftBukkit start
|
|
+ // this.level().explode(this, this.getX(), this.getY(), this.getZ(), 1.0F, false, World.a.MOB);
|
|
+ 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(), World.a.MOB);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
|
}
|
|
|
|
}
|