craftbukkit/nms-patches/net/minecraft/world/entity/projectile/EntityWitherSkull.patch

47 lines
2.2 KiB
Diff
Raw Normal View History

2021-03-16 09:00:00 +11:00
--- a/net/minecraft/world/entity/projectile/EntityWitherSkull.java
+++ b/net/minecraft/world/entity/projectile/EntityWitherSkull.java
2022-12-08 03:00:00 +11:00
@@ -20,6 +20,8 @@
2021-03-16 09:00:00 +11:00
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.MovingObjectPositionEntity;
+import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
+
public class EntityWitherSkull extends EntityFireball {
2021-11-22 09:00:00 +11:00
private static final DataWatcherObject<Boolean> DATA_DANGEROUS = DataWatcher.defineId(EntityWitherSkull.class, DataWatcherRegistry.BOOLEAN);
2022-12-08 03:00:00 +11:00
@@ -63,7 +65,7 @@
2020-06-25 10:00:00 +10:00
if (entity.isAlive()) {
2021-11-22 09:00:00 +11:00
this.doEnchantDamageEffects(entityliving, entity);
2020-06-25 10:00:00 +10:00
} else {
- entityliving.heal(5.0F);
+ entityliving.heal(5.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit
}
2020-06-25 10:00:00 +10:00
}
} else {
2023-03-15 03:30:00 +11:00
@@ -81,7 +83,7 @@
2020-06-25 10:00:00 +10:00
}
2020-06-25 10:00:00 +10:00
if (b0 > 0) {
2023-03-15 03:30:00 +11:00
- 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
}
}
2023-03-15 03:30:00 +11:00
@@ -92,7 +94,15 @@
2022-12-08 03:00:00 +11:00
protected void onHit(MovingObjectPosition movingobjectposition) {
super.onHit(movingobjectposition);
2023-06-08 01:30:00 +10:00
if (!this.level().isClientSide) {
- this.level().explode(this, this.getX(), this.getY(), this.getZ(), 1.0F, false, World.a.MOB);
+ // CraftBukkit start
2023-06-08 01:30:00 +10:00
+ // 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);
2023-06-08 01:30:00 +10:00
+ this.level().getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
2023-06-08 01:30:00 +10:00
+ this.level().explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.MOB);
+ }
+ // CraftBukkit end
2021-11-22 09:00:00 +11:00
this.discard();
}