PaperMC/paper-server/nms-patches/net/minecraft/world/level/block/BlockDirtSnowSpreadable.patch
CraftBukkit/Spigot 43702a9e10 Update to Minecraft 1.18-pre5
By: md_5 <git@md-5.net>
2021-11-22 09:00:00 +11:00

23 lines
1.6 KiB
Diff

--- a/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java
+++ b/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java
@@ -41,6 +41,11 @@
@Override
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
if (!canBeGrass(iblockdata, worldserver, blockposition)) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.DIRT.defaultBlockState()).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
worldserver.setBlockAndUpdate(blockposition, Blocks.DIRT.defaultBlockState());
} else {
if (worldserver.getMaxLocalRawBrightness(blockposition.above()) >= 9) {
@@ -50,7 +55,7 @@
BlockPosition blockposition1 = blockposition.offset(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);
if (worldserver.getBlockState(blockposition1).is(Blocks.DIRT) && canPropagate(iblockdata1, worldserver, blockposition1)) {
- worldserver.setBlockAndUpdate(blockposition1, (IBlockData) iblockdata1.setValue(BlockDirtSnowSpreadable.SNOWY, worldserver.getBlockState(blockposition1.above()).is(Blocks.SNOW)));
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, (IBlockData) iblockdata1.setValue(BlockDirtSnowSpreadable.SNOWY, worldserver.getBlockState(blockposition1.above()).is(Blocks.SNOW))); // CraftBukkit
}
}
}