PaperMC/paper-server/nms-patches/net/minecraft/world/entity/projectile/EntitySmallFireball.patch
CraftBukkit/Spigot 9d740b84b0 Update to Minecraft 1.20
By: md_5 <git@md-5.net>
2023-06-08 01:30:00 +10:00

52 lines
2.7 KiB
Diff

--- a/net/minecraft/world/entity/projectile/EntitySmallFireball.java
+++ b/net/minecraft/world/entity/projectile/EntitySmallFireball.java
@@ -13,6 +13,8 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
import net.minecraft.world.phys.MovingObjectPositionEntity;
+import org.bukkit.event.entity.EntityCombustByEntityEvent; // CraftBukkit
+
public class EntitySmallFireball extends EntityFireballFireball {
public EntitySmallFireball(EntityTypes<? extends EntitySmallFireball> entitytypes, World world) {
@@ -21,6 +23,11 @@
public EntitySmallFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) {
super(EntityTypes.SMALL_FIREBALL, entityliving, d0, d1, d2, world);
+ // CraftBukkit start
+ if (this.getOwner() != null && this.getOwner() instanceof EntityInsentient) {
+ isIncendiary = this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
+ }
+ // CraftBukkit end
}
public EntitySmallFireball(World world, double d0, double d1, double d2, double d3, double d4, double d5) {
@@ -35,7 +42,14 @@
Entity entity1 = this.getOwner();
int i = entity.getRemainingFireTicks();
- entity.setSecondsOnFire(5);
+ // 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 EntityLiving) {
@@ -51,10 +65,10 @@
if (!this.level().isClientSide) {
Entity entity = this.getOwner();
- if (!(entity instanceof EntityInsentient) || this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
+ if (isIncendiary) { // CraftBukkit
BlockPosition blockposition = movingobjectpositionblock.getBlockPos().relative(movingobjectpositionblock.getDirection());
- if (this.level().isEmptyBlock(blockposition)) {
+ if (this.level().isEmptyBlock(blockposition) && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.level(), blockposition, this).isCancelled()) { // CraftBukkit
this.level().setBlockAndUpdate(blockposition, BlockFireAbstract.getState(this.level(), blockposition));
}
}