diff options
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/SmallFireball.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/SmallFireball.java.patch | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/SmallFireball.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/SmallFireball.java.patch new file mode 100644 index 0000000000..f62e624986 --- /dev/null +++ b/patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/SmallFireball.java.patch @@ -0,0 +1,93 @@ +--- a/net/minecraft/world/entity/projectile/SmallFireball.java ++++ b/net/minecraft/world/entity/projectile/SmallFireball.java +@@ -12,18 +12,25 @@ + import net.minecraft.world.phys.BlockHitResult; + import net.minecraft.world.phys.EntityHitResult; + import net.minecraft.world.phys.HitResult; ++import org.bukkit.event.entity.EntityCombustByEntityEvent; // CraftBukkit + + public class SmallFireball extends Fireball { ++ + public SmallFireball(EntityType<? extends SmallFireball> entityType, Level level) { + super(entityType, level); + } + +- public SmallFireball(Level level, LivingEntity shooter, double offsetX, double offsetY, double offsetZ) { +- super(EntityType.SMALL_FIREBALL, shooter, offsetX, offsetY, offsetZ, level); ++ public SmallFireball(Level level, LivingEntity shooter, double offsetX, double d1, double offsetY) { ++ super(EntityType.SMALL_FIREBALL, shooter, offsetX, d1, offsetY, level); ++ // CraftBukkit start ++ if (this.getOwner() != null && this.getOwner() instanceof Mob) { ++ isIncendiary = this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); ++ } ++ // CraftBukkit end + } + +- public SmallFireball(Level level, double x, double y, double z, double offsetX, double offsetY, double offsetZ) { +- super(EntityType.SMALL_FIREBALL, x, y, z, offsetX, offsetY, offsetZ, level); ++ public SmallFireball(Level level, double x, double d1, double y, double d3, double z, double d5) { ++ super(EntityType.SMALL_FIREBALL, x, d1, y, d3, z, d5, level); + } + + @Override +@@ -31,14 +38,23 @@ + super.onHitEntity(result); + if (!this.level().isClientSide) { + Entity entity = result.getEntity(); +- Entity owner = this.getOwner(); +- int remainingFireTicks = entity.getRemainingFireTicks(); +- entity.setSecondsOnFire(5); +- if (!entity.hurt(this.damageSources().fireball(this, owner), 5.0F)) { +- entity.setRemainingFireTicks(remainingFireTicks); +- } else if (owner instanceof LivingEntity) { +- this.doEnchantDamageEffects((LivingEntity)owner, entity); ++ Entity entity1 = this.getOwner(); ++ int i = entity.getRemainingFireTicks(); ++ ++ // CraftBukkit start - Entity damage by entity event + combust event ++ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), entity.getBukkitEntity(), 5); ++ entity.level().getCraftServer().getPluginManager().callEvent(event); ++ ++ if (!event.isCancelled()) { ++ entity.setSecondsOnFire(event.getDuration(), false); + } ++ // CraftBukkit end ++ if (!entity.hurt(this.damageSources().fireball(this, entity1), 5.0F)) { ++ entity.setRemainingFireTicks(i); ++ } else if (entity1 instanceof LivingEntity) { ++ this.doEnchantDamageEffects((LivingEntity) entity1, entity); ++ } ++ + } + } + +@@ -46,13 +62,16 @@ + protected void onHitBlock(BlockHitResult result) { + super.onHitBlock(result); + if (!this.level().isClientSide) { +- Entity owner = this.getOwner(); +- if (!(owner instanceof Mob) || this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { +- BlockPos blockPos = result.getBlockPos().relative(result.getDirection()); +- if (this.level().isEmptyBlock(blockPos)) { +- this.level().setBlockAndUpdate(blockPos, BaseFireBlock.getState(this.level(), blockPos)); ++ Entity entity = this.getOwner(); ++ ++ if (isIncendiary) { // CraftBukkit ++ BlockPos blockposition = result.getBlockPos().relative(result.getDirection()); ++ ++ if (this.level().isEmptyBlock(blockposition) && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.level(), blockposition, this).isCancelled()) { // CraftBukkit ++ this.level().setBlockAndUpdate(blockposition, BaseFireBlock.getState(this.level(), blockposition)); + } + } ++ + } + } + +@@ -62,6 +81,7 @@ + if (!this.level().isClientSide) { + this.discard(); + } ++ + } + + @Override |