aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/WitherSkull.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/WitherSkull.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/WitherSkull.java.patch130
1 files changed, 130 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/WitherSkull.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/WitherSkull.java.patch
new file mode 100644
index 0000000000..1ffc1a5de3
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/WitherSkull.java.patch
@@ -0,0 +1,130 @@
+--- a/net/minecraft/world/entity/projectile/WitherSkull.java
++++ b/net/minecraft/world/entity/projectile/WitherSkull.java
+@@ -16,20 +16,24 @@
+ import net.minecraft.world.level.BlockGetter;
+ import net.minecraft.world.level.Explosion;
+ import net.minecraft.world.level.Level;
+-import net.minecraft.world.level.block.state.BlockState;
++import net.minecraft.world.level.block.state.IBlockData;
+ import net.minecraft.world.level.material.FluidState;
+ import net.minecraft.world.phys.EntityHitResult;
+ import net.minecraft.world.phys.HitResult;
++// CraftBukkit start
++import org.bukkit.event.entity.ExplosionPrimeEvent;
++// CraftBukkit end
+
+ public class WitherSkull extends AbstractHurtingProjectile {
++
+ private static final EntityDataAccessor<Boolean> DATA_DANGEROUS = SynchedEntityData.defineId(WitherSkull.class, EntityDataSerializers.BOOLEAN);
+
+ public WitherSkull(EntityType<? extends WitherSkull> entityType, Level level) {
+ super(entityType, level);
+ }
+
+- public WitherSkull(Level level, LivingEntity shooter, double offsetX, double offsetY, double offsetZ) {
+- super(EntityType.WITHER_SKULL, shooter, offsetX, offsetY, offsetZ, level);
++ public WitherSkull(Level level, LivingEntity shooter, double offsetX, double d1, double offsetY) {
++ super(EntityType.WITHER_SKULL, shooter, offsetX, d1, offsetY, level);
+ }
+
+ @Override
+@@ -43,9 +47,7 @@
+ }
+
+ @Override
+- public float getBlockExplosionResistance(
+- Explosion explosion, BlockGetter level, BlockPos pos, BlockState blockState, FluidState fluidState, float explosionPower
+- ) {
++ public float getBlockExplosionResistance(Explosion explosion, BlockGetter level, BlockPos pos, IBlockData blockState, FluidState fluidState, float explosionPower) {
+ return this.isDangerous() && WitherBoss.canDestroy(blockState) ? Math.min(0.8F, explosionPower) : explosionPower;
+ }
+
+@@ -54,32 +56,39 @@
+ super.onHitEntity(result);
+ if (!this.level().isClientSide) {
+ Entity entity = result.getEntity();
++ Entity entity1 = this.getOwner();
++ LivingEntity entityliving;
+ boolean flag;
+- if (this.getOwner() instanceof LivingEntity livingEntity) {
+- flag = entity.hurt(this.damageSources().witherSkull(this, livingEntity), 8.0F);
++
++ if (entity1 instanceof LivingEntity) {
++ entityliving = (LivingEntity) entity1;
++ flag = entity.hurt(this.damageSources().witherSkull(this, entityliving), 8.0F);
+ if (flag) {
+ if (entity.isAlive()) {
+- this.doEnchantDamageEffects(livingEntity, entity);
++ this.doEnchantDamageEffects(entityliving, entity);
+ } else {
+- livingEntity.heal(5.0F);
++ entityliving.heal(5.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit
+ }
+ }
+ } else {
+ flag = entity.hurt(this.damageSources().magic(), 5.0F);
+ }
+
+- if (flag && entity instanceof LivingEntity livingEntityx) {
+- int i = 0;
++ if (flag && entity instanceof LivingEntity) {
++ entityliving = (LivingEntity) entity;
++ byte b0 = 0;
++
+ if (this.level().getDifficulty() == Difficulty.NORMAL) {
+- i = 10;
++ b0 = 10;
+ } else if (this.level().getDifficulty() == Difficulty.HARD) {
+- i = 40;
++ b0 = 40;
+ }
+
+- if (i > 0) {
+- livingEntityx.addEffect(new MobEffectInstance(MobEffects.WITHER, 20 * i, 1), this.getEffectSource());
++ if (b0 > 0) {
++ entityliving.addEffect(new MobEffectInstance(MobEffects.WITHER, 20 * b0, 1), this.getEffectSource(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
+ }
+ }
++
+ }
+ }
+
+@@ -87,9 +96,18 @@
+ protected void onHit(HitResult result) {
+ super.onHit(result);
+ if (!this.level().isClientSide) {
+- this.level().explode(this, this.getX(), this.getY(), this.getZ(), 1.0F, false, Level.ExplosionInteraction.MOB);
++ // 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(), Level.a.MOB);
++ }
++ // CraftBukkit end
+ this.discard();
+ }
++
+ }
+
+ @Override
+@@ -104,15 +122,15 @@
+
+ @Override
+ protected void defineSynchedData() {
+- this.entityData.define(DATA_DANGEROUS, false);
++ this.entityData.define(WitherSkull.DATA_DANGEROUS, false);
+ }
+
+ public boolean isDangerous() {
+- return this.entityData.get(DATA_DANGEROUS);
++ return (Boolean) this.entityData.get(WitherSkull.DATA_DANGEROUS);
+ }
+
+ public void setDangerous(boolean invulnerable) {
+- this.entityData.set(DATA_DANGEROUS, invulnerable);
++ this.entityData.set(WitherSkull.DATA_DANGEROUS, invulnerable);
+ }
+
+ @Override