From 52f92816560fb5a77b271fba4f59a1e52ef56942 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sat, 11 Jun 2022 13:20:38 +1000 Subject: [PATCH] #1065: Add missing calls for BlockSpreadEvent when Sculk spreads By: Brokkonaut --- .../minecraft/world/level/block/SculkBlock.patch | 16 ++++++++++++++++ .../world/level/block/SculkVeinBlock.patch | 15 +++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 paper-server/nms-patches/net/minecraft/world/level/block/SculkBlock.patch create mode 100644 paper-server/nms-patches/net/minecraft/world/level/block/SculkVeinBlock.patch diff --git a/paper-server/nms-patches/net/minecraft/world/level/block/SculkBlock.patch b/paper-server/nms-patches/net/minecraft/world/level/block/SculkBlock.patch new file mode 100644 index 0000000000..de00f4b3d7 --- /dev/null +++ b/paper-server/nms-patches/net/minecraft/world/level/block/SculkBlock.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/world/level/block/SculkBlock.java ++++ b/net/minecraft/world/level/block/SculkBlock.java +@@ -35,8 +35,11 @@ + BlockPosition blockposition2 = blockposition1.above(); + IBlockData iblockdata = this.getRandomGrowthState(generatoraccess, blockposition2, randomsource, sculkspreader.isWorldGeneration()); + +- generatoraccess.setBlock(blockposition2, iblockdata, 3); +- generatoraccess.playSound((EntityHuman) null, blockposition1, iblockdata.getSoundType().getPlaceSound(), SoundCategory.BLOCKS, 1.0F, 1.0F); ++ // CraftBukkit start - Call BlockSpreadEvent ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(generatoraccess, blockposition1, blockposition2, iblockdata, 3)) { ++ generatoraccess.playSound((EntityHuman) null, blockposition1, iblockdata.getSoundType().getPlaceSound(), SoundCategory.BLOCKS, 1.0F, 1.0F); ++ } ++ // CraftBukkit end + } + + return Math.max(0, i - j); diff --git a/paper-server/nms-patches/net/minecraft/world/level/block/SculkVeinBlock.patch b/paper-server/nms-patches/net/minecraft/world/level/block/SculkVeinBlock.patch new file mode 100644 index 0000000000..de8406ab90 --- /dev/null +++ b/paper-server/nms-patches/net/minecraft/world/level/block/SculkVeinBlock.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/world/level/block/SculkVeinBlock.java ++++ b/net/minecraft/world/level/block/SculkVeinBlock.java +@@ -121,7 +121,11 @@ + if (iblockdata1.is(tagkey)) { + IBlockData iblockdata2 = Blocks.SCULK.defaultBlockState(); + +- generatoraccess.setBlock(blockposition1, iblockdata2, 3); ++ // CraftBukkit start - Call BlockSpreadEvent ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(generatoraccess, blockposition, blockposition1, iblockdata2, 3)) { ++ return false; ++ } ++ // CraftBukkit end + Block.pushEntitiesUp(iblockdata1, iblockdata2, generatoraccess, blockposition1); + generatoraccess.playSound((EntityHuman) null, blockposition1, SoundEffects.SCULK_BLOCK_SPREAD, SoundCategory.BLOCKS, 1.0F, 1.0F); + this.veinSpreader.spreadAll(iblockdata2, generatoraccess, blockposition1, sculkspreader.isWorldGeneration());