From a10530b21323e9d4567bf608bf7aa283a5cc9c92 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 14 Oct 2026 21:17:02 +0000 Subject: [PATCH 1/4] Fix lava combust event spam and null combuster Inline Paper combust-once + combuster block rules in burnFromLava. Co-authored-by: xii69 --- .../java/net/minecraft/server/Entity.java | 72 ++++++++++++------- 1 file changed, 47 insertions(+), 25 deletions(-) diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/Entity.java b/WindSpigot-Server/src/main/java/net/minecraft/server/Entity.java index d84fa7bc0..dcc7e1f38 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/Entity.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/Entity.java @@ -21,6 +21,7 @@ import org.bukkit.entity.Painting; import org.bukkit.entity.Vehicle; import org.bukkit.event.entity.EntityCombustByEntityEvent; +import org.bukkit.event.entity.EntityCombustByBlockEvent; import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityPortalEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent; @@ -106,6 +107,8 @@ static boolean isLevelAtLeast(NBTTagCompound tag, int level) { public int noDamageTicks; protected boolean justCreated; protected boolean fireProof; + /** Last lava block intersecting the in-lava AABB (Paper-style; for Bukkit events). */ + public BlockPosition lastLavaContact; protected DataWatcher datawatcher; private double ar; private double as; @@ -427,30 +430,22 @@ protected void burnFromLava() { if (!this.fireProof) { this.damageEntity(DamageSource.LAVA, 4.0F); - // CraftBukkit start - Fallen in lava TODO: this event spams! - if (this instanceof EntityLiving) { - if (fireTicks <= 0) { - // not on fire yet - // TODO: shouldn't be sending null for the block - org.bukkit.block.Block damager = null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k); - org.bukkit.entity.Entity damagee = this.getBukkitEntity(); - EntityCombustEvent combustEvent = new org.bukkit.event.entity.EntityCombustByBlockEvent(damager, - damagee, 15); - this.world.getServer().getPluginManager().callEvent(combustEvent); - - if (!combustEvent.isCancelled()) { - this.setOnFire(combustEvent.getDuration()); - } - } else { - // This will be called every single tick the entity is in lava, so don't throw - // an event - this.setOnFire(15); + // CraftBukkit / WindSpigot - lava combust once for living; pass real combuster block + if (this instanceof EntityLiving && this.fireTicks <= 0) { + org.bukkit.block.Block damager = null; + if (this.lastLavaContact != null) { + damager = this.world.getWorld().getBlockAt(this.lastLavaContact.getX(), this.lastLavaContact.getY(), + this.lastLavaContact.getZ()); } - return; + EntityCombustEvent combustEvent = new EntityCombustByBlockEvent(damager, this.getBukkitEntity(), 15); + this.world.getServer().getPluginManager().callEvent(combustEvent); + if (!combustEvent.isCancelled()) { + this.setOnFire(combustEvent.getDuration()); + } + } else { + this.setOnFire(15); } - // CraftBukkit end - we also don't throw an event unless the object in lava is - // living, to save on some event calls - this.setOnFire(15); + // CraftBukkit end } } @@ -1146,9 +1141,36 @@ public boolean a(Material material) { } public boolean ab() { - return this.world.a( - this.getBoundingBox().grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), - Material.LAVA); + this.lastLavaContact = this.findLavaContact(); + return this.lastLavaContact != null; + } + + /** + * First lava block in the same AABB used by {@link #ab()}, or {@code null}. + * Mirrors {@link World#a(AxisAlignedBB, Material)} but keeps the contact position + * for {@link org.bukkit.event.entity.EntityCombustByBlockEvent}. + */ + private BlockPosition findLavaContact() { + AxisAlignedBB box = this.getBoundingBox().grow(-0.10000000149011612D, -0.4000000059604645D, + -0.10000000149011612D); + int minX = MathHelper.floor(box.a); + int maxX = MathHelper.floor(box.d + 1.0D); + int minY = MathHelper.floor(box.b); + int maxY = MathHelper.floor(box.e + 1.0D); + int minZ = MathHelper.floor(box.c); + int maxZ = MathHelper.floor(box.f + 1.0D); + BlockPosition.MutableBlockPosition cursor = new BlockPosition.MutableBlockPosition(); + + for (int x = minX; x < maxX; ++x) { + for (int y = minY; y < maxY; ++y) { + for (int z = minZ; z < maxZ; ++z) { + if (this.world.getType(cursor.c(x, y, z)).getBlock().getMaterial() == Material.LAVA) { + return new BlockPosition(x, y, z); + } + } + } + } + return null; } public void a(float f, float f1, float f2) { From ec6b7fbc7bce63712d0870125ab2ec6ee38ede33 Mon Sep 17 00:00:00 2001 From: Elias Date: Mon, 19 Oct 2026 20:00:22 +0200 Subject: [PATCH 2/4] Update Entity.java --- .../main/java/net/minecraft/server/Entity.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/Entity.java b/WindSpigot-Server/src/main/java/net/minecraft/server/Entity.java index d84fa7bc0..2c5909f09 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/Entity.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/Entity.java @@ -188,6 +188,11 @@ public void inactiveTick() { } // Spigot end + // Migot start + private boolean isInLava; + private int lastLavaCheck = Integer.MIN_VALUE; + // Migot end + public int getId() { return this.id; } @@ -1146,9 +1151,15 @@ public boolean a(Material material) { } public boolean ab() { - return this.world.a( - this.getBoundingBox().grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), - Material.LAVA); + // Migot start - Check for lava only once per tick + // return this.world.a(this.getBoundingBox().grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA); + int currentTick = MinecraftServer.currentTick; + if (this.lastLavaCheck != currentTick) { + this.lastLavaCheck = currentTick; + this.isInLava = this.world.a(this.getBoundingBox().grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA); + } + return this.isInLava; + // Migot end } public void a(float f, float f1, float f2) { From 1c4351e4e7fd13d8057d67102c66e602d7944580 Mon Sep 17 00:00:00 2001 From: Elias Date: Mon, 19 Oct 2026 20:00:53 +0200 Subject: [PATCH 3/4] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 50254f383..7bbe508bd 100644 --- a/README.md +++ b/README.md @@ -212,6 +212,7 @@ See the patches list below. [MineTick-0017] Fix Insane Nether Portal Lag [Migot-0009] Prevent Creature Spawning in Unloaded Chunks +[Migot-0036] Check for lava only once per tick [Sugarcane-0022] Add YAML comments From 1e33716ab5ed855604631afe5f35b833142b4185 Mon Sep 17 00:00:00 2001 From: Elias Date: Mon, 19 Oct 2026 20:05:42 +0200 Subject: [PATCH 4/4] Update Entity.java --- WindSpigot-Server/src/main/java/net/minecraft/server/Entity.java | 1 - 1 file changed, 1 deletion(-) diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/Entity.java b/WindSpigot-Server/src/main/java/net/minecraft/server/Entity.java index 7d0709fae..2c5909f09 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/Entity.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/Entity.java @@ -21,7 +21,6 @@ import org.bukkit.entity.Painting; import org.bukkit.entity.Vehicle; import org.bukkit.event.entity.EntityCombustByEntityEvent; -import org.bukkit.event.entity.EntityCombustByBlockEvent; import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityPortalEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent;