PaperMC/paper-server/nms-patches/net/minecraft/world/level/block/SculkVeinBlock.patch
CraftBukkit/Spigot 8398e12b34 Update to Minecraft 1.20.3
By: md_5 <git@md-5.net>
2023-12-06 03:40:00 +11:00

29 lines
2.5 KiB
Diff

--- a/net/minecraft/world/level/block/SculkVeinBlock.java
+++ b/net/minecraft/world/level/block/SculkVeinBlock.java
@@ -108,10 +108,11 @@
@Override
public int attemptUseCharge(SculkSpreader.a sculkspreader_a, GeneratorAccess generatoraccess, BlockPosition blockposition, RandomSource randomsource, SculkSpreader sculkspreader, boolean flag) {
- return flag && this.attemptPlaceSculk(sculkspreader, generatoraccess, sculkspreader_a.getPos(), randomsource) ? sculkspreader_a.getCharge() - 1 : (randomsource.nextInt(sculkspreader.chargeDecayRate()) == 0 ? MathHelper.floor((float) sculkspreader_a.getCharge() * 0.5F) : sculkspreader_a.getCharge());
+ // CraftBukkit - add source block
+ return flag && this.attemptPlaceSculk(sculkspreader, generatoraccess, sculkspreader_a.getPos(), randomsource, blockposition) ? sculkspreader_a.getCharge() - 1 : (randomsource.nextInt(sculkspreader.chargeDecayRate()) == 0 ? MathHelper.floor((float) sculkspreader_a.getCharge() * 0.5F) : sculkspreader_a.getCharge());
}
- private boolean attemptPlaceSculk(SculkSpreader sculkspreader, GeneratorAccess generatoraccess, BlockPosition blockposition, RandomSource randomsource) {
+ private boolean attemptPlaceSculk(SculkSpreader sculkspreader, GeneratorAccess generatoraccess, BlockPosition blockposition, RandomSource randomsource, BlockPosition sourceBlock) { // CraftBukkit
IBlockData iblockdata = generatoraccess.getBlockState(blockposition);
TagKey<Block> tagkey = sculkspreader.replaceableBlocks();
Iterator iterator = EnumDirection.allShuffled(randomsource).iterator();
@@ -126,7 +127,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, sourceBlock, 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());