From 2f0c34a2cf073fb7fbb461d21f947916d3550f57 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Mon, 5 Aug 2024 17:28:37 +1000 Subject: [PATCH] SPIGOT-7855: Fire does not spread or burn blocks By: md_5 --- .../world/level/block/BlockFire.patch | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/paper-server/nms-patches/net/minecraft/world/level/block/BlockFire.patch b/paper-server/nms-patches/net/minecraft/world/level/block/BlockFire.patch index b172681be6..a783ad8ddb 100644 --- a/paper-server/nms-patches/net/minecraft/world/level/block/BlockFire.patch +++ b/paper-server/nms-patches/net/minecraft/world/level/block/BlockFire.patch @@ -1,10 +1,11 @@ --- a/net/minecraft/world/level/block/BlockFire.java +++ b/net/minecraft/world/level/block/BlockFire.java -@@ -29,6 +29,14 @@ +@@ -29,6 +29,15 @@ import net.minecraft.world.phys.shapes.VoxelShapeCollision; import net.minecraft.world.phys.shapes.VoxelShapes; +// CraftBukkit start ++import net.minecraft.world.item.context.ItemActionContext; +import org.bukkit.craftbukkit.block.CraftBlockState; +import org.bukkit.craftbukkit.block.CraftBlockStates; +import org.bukkit.craftbukkit.event.CraftEventFactory; @@ -15,7 +16,7 @@ public class BlockFire extends BlockFireAbstract { public static final MapCodec CODEC = simpleCodec(BlockFire::new); -@@ -100,7 +108,24 @@ +@@ -100,7 +109,24 @@ @Override protected IBlockData updateShape(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) { @@ -41,7 +42,7 @@ } @Override -@@ -149,7 +174,7 @@ +@@ -149,7 +175,7 @@ worldserver.scheduleTick(blockposition, (Block) this, getFireTickDelay(worldserver.random)); if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) { if (!iblockdata.canSurvive(worldserver, blockposition)) { @@ -50,7 +51,7 @@ } IBlockData iblockdata1 = worldserver.getBlockState(blockposition.below()); -@@ -157,7 +182,7 @@ +@@ -157,7 +183,7 @@ int i = (Integer) iblockdata.getValue(BlockFire.AGE); if (!flag && worldserver.isRaining() && this.isNearRain(worldserver, blockposition) && randomsource.nextFloat() < 0.2F + (float) i * 0.03F) { @@ -59,7 +60,7 @@ } else { int j = Math.min(15, i + randomsource.nextInt(3) / 2); -@@ -171,14 +196,14 @@ +@@ -171,14 +197,14 @@ BlockPosition blockposition1 = blockposition.below(); if (!worldserver.getBlockState(blockposition1).isFaceSturdy(worldserver, blockposition1, EnumDirection.UP) || i > 3) { @@ -76,7 +77,7 @@ return; } } -@@ -186,12 +211,14 @@ +@@ -186,12 +212,14 @@ boolean flag1 = worldserver.getBiome(blockposition).is(BiomeTags.INCREASED_FIRE_BURNOUT); int k = flag1 ? -50 : 0; @@ -97,7 +98,7 @@ BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); for (int l = -1; l <= 1; ++l) { -@@ -217,7 +244,15 @@ +@@ -217,7 +245,15 @@ if (i2 > 0 && randomsource.nextInt(k1) <= i2 && (!worldserver.isRaining() || !this.isNearRain(worldserver, blockposition_mutableblockposition))) { int j2 = Math.min(15, i + randomsource.nextInt(5) / 4); @@ -114,7 +115,7 @@ } } } -@@ -241,12 +276,28 @@ +@@ -241,12 +277,28 @@ return iblockdata.hasProperty(BlockProperties.WATERLOGGED) && (Boolean) iblockdata.getValue(BlockProperties.WATERLOGGED) ? 0 : this.igniteOdds.getInt(iblockdata.getBlock()); } @@ -144,3 +145,16 @@ if (randomsource.nextInt(j + 10) < 5 && !world.isRainingAt(blockposition)) { int l = Math.min(j + randomsource.nextInt(5) / 4, 15); +@@ -310,8 +362,10 @@ + } + + @Override +- protected void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) { +- super.onPlace(iblockdata, world, blockposition, iblockdata1, flag); ++ // CraftBukkit start - context ++ protected void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag, ItemActionContext context) { ++ super.onPlace(iblockdata, world, blockposition, iblockdata1, flag, context); ++ // CraftBukkit end + world.scheduleTick(blockposition, (Block) this, getFireTickDelay(world.random)); + } +