aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java.patch83
1 files changed, 83 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java.patch
new file mode 100644
index 0000000000..777fbd096e
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java.patch
@@ -0,0 +1,83 @@
+--- a/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
++++ b/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
+@@ -8,52 +8,61 @@
+ import net.minecraft.util.RandomSource;
+ import net.minecraft.world.level.LevelReader;
+ import net.minecraft.world.level.block.state.BlockBehaviour;
+-import net.minecraft.world.level.block.state.BlockState;
++import net.minecraft.world.level.block.state.IBlockData;
+ import net.minecraft.world.level.lighting.LightEngine;
+
+ public abstract class SpreadingSnowyDirtBlock extends SnowyDirtBlock {
++
+ protected SpreadingSnowyDirtBlock(BlockBehaviour.Properties properties) {
+ super(properties);
+ }
+
+- private static boolean canBeGrass(BlockState state, LevelReader levelReader, BlockPos pos) {
+- BlockPos blockPos = pos.above();
+- BlockState blockState = levelReader.getBlockState(blockPos);
+- if (blockState.is(Blocks.SNOW) && blockState.getValue(SnowLayerBlock.LAYERS) == 1) {
++ private static boolean canBeGrass(IBlockData state, LevelReader levelReader, BlockPos pos) {
++ BlockPos blockposition1 = pos.above();
++ IBlockData iblockdata1 = levelReader.getBlockState(blockposition1);
++
++ if (iblockdata1.is(Blocks.SNOW) && (Integer) iblockdata1.getValue(SnowLayerBlock.LAYERS) == 1) {
+ return true;
+- } else if (blockState.getFluidState().getAmount() == 8) {
++ } else if (iblockdata1.getFluidState().getAmount() == 8) {
+ return false;
+ } else {
+- int lightBlockInto = LightEngine.getLightBlockInto(
+- levelReader, state, pos, blockState, blockPos, Direction.UP, blockState.getLightBlock(levelReader, blockPos)
+- );
+- return lightBlockInto < levelReader.getMaxLightLevel();
++ int i = LightEngine.getLightBlockInto(levelReader, state, pos, iblockdata1, blockposition1, Direction.UP, iblockdata1.getLightBlock(levelReader, blockposition1));
++
++ return i < levelReader.getMaxLightLevel();
+ }
+ }
+
+ @Override
+ protected abstract MapCodec<? extends SpreadingSnowyDirtBlock> codec();
+
+- private static boolean canPropagate(BlockState state, LevelReader level, BlockPos pos) {
+- BlockPos blockPos = pos.above();
+- return canBeGrass(state, level, pos) && !level.getFluidState(blockPos).is(FluidTags.WATER);
++ private static boolean canPropagate(IBlockData state, LevelReader level, BlockPos pos) {
++ BlockPos blockposition1 = pos.above();
++
++ return canBeGrass(state, level, pos) && !level.getFluidState(blockposition1).is(FluidTags.WATER);
+ }
+
+ @Override
+- public void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
++ public void randomTick(IBlockData state, ServerLevel level, BlockPos pos, RandomSource random) {
+ if (!canBeGrass(state, level, pos)) {
++ // CraftBukkit start
++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(level, pos, Blocks.DIRT.defaultBlockState()).isCancelled()) {
++ return;
++ }
++ // CraftBukkit end
+ level.setBlockAndUpdate(pos, Blocks.DIRT.defaultBlockState());
+ } else {
+ if (level.getMaxLocalRawBrightness(pos.above()) >= 9) {
+- BlockState blockState = this.defaultBlockState();
++ IBlockData iblockdata1 = this.defaultBlockState();
+
+- for (int i = 0; i < 4; i++) {
+- BlockPos blockPos = pos.offset(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);
+- if (level.getBlockState(blockPos).is(Blocks.DIRT) && canPropagate(blockState, level, blockPos)) {
+- level.setBlockAndUpdate(blockPos, blockState.setValue(SNOWY, Boolean.valueOf(level.getBlockState(blockPos.above()).is(Blocks.SNOW))));
++ for (int i = 0; i < 4; ++i) {
++ BlockPos blockposition1 = pos.offset(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);
++
++ if (level.getBlockState(blockposition1).is(Blocks.DIRT) && canPropagate(iblockdata1, level, blockposition1)) {
++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(level, pos, blockposition1, (IBlockData) iblockdata1.setValue(SpreadingSnowyDirtBlock.SNOWY, level.getBlockState(blockposition1.above()).is(Blocks.SNOW))); // CraftBukkit
+ }
+ }
+ }
++
+ }
+ }
+ }