diff options
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/level/block/BuddingAmethystBlock.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower/net/minecraft/world/level/block/BuddingAmethystBlock.java.patch | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/level/block/BuddingAmethystBlock.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/level/block/BuddingAmethystBlock.java.patch new file mode 100644 index 0000000000..f892e73a4e --- /dev/null +++ b/patch-remap/mache-vineflower/net/minecraft/world/level/block/BuddingAmethystBlock.java.patch @@ -0,0 +1,70 @@ +--- a/net/minecraft/world/level/block/BuddingAmethystBlock.java ++++ b/net/minecraft/world/level/block/BuddingAmethystBlock.java +@@ -6,17 +6,18 @@ + import net.minecraft.server.level.ServerLevel; + import net.minecraft.util.RandomSource; + 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.material.Fluids; + + public class BuddingAmethystBlock extends AmethystBlock { ++ + public static final MapCodec<BuddingAmethystBlock> CODEC = simpleCodec(BuddingAmethystBlock::new); + public static final int GROWTH_CHANCE = 5; + private static final Direction[] DIRECTIONS = Direction.values(); + + @Override + public MapCodec<BuddingAmethystBlock> codec() { +- return CODEC; ++ return BuddingAmethystBlock.CODEC; + } + + public BuddingAmethystBlock(BlockBehaviour.Properties properties) { +@@ -24,32 +25,33 @@ + } + + @Override +- public void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { ++ public void randomTick(IBlockData state, ServerLevel level, BlockPos pos, RandomSource random) { + if (random.nextInt(5) == 0) { +- Direction direction = DIRECTIONS[random.nextInt(DIRECTIONS.length)]; +- BlockPos blockPos = pos.relative(direction); +- BlockState blockState = level.getBlockState(blockPos); ++ Direction enumdirection = BuddingAmethystBlock.DIRECTIONS[random.nextInt(BuddingAmethystBlock.DIRECTIONS.length)]; ++ BlockPos blockposition1 = pos.relative(enumdirection); ++ IBlockData iblockdata1 = level.getBlockState(blockposition1); + Block block = null; +- if (canClusterGrowAtState(blockState)) { ++ ++ if (canClusterGrowAtState(iblockdata1)) { + block = Blocks.SMALL_AMETHYST_BUD; +- } else if (blockState.is(Blocks.SMALL_AMETHYST_BUD) && blockState.getValue(AmethystClusterBlock.FACING) == direction) { ++ } else if (iblockdata1.is(Blocks.SMALL_AMETHYST_BUD) && iblockdata1.getValue(AmethystClusterBlock.FACING) == enumdirection) { + block = Blocks.MEDIUM_AMETHYST_BUD; +- } else if (blockState.is(Blocks.MEDIUM_AMETHYST_BUD) && blockState.getValue(AmethystClusterBlock.FACING) == direction) { ++ } else if (iblockdata1.is(Blocks.MEDIUM_AMETHYST_BUD) && iblockdata1.getValue(AmethystClusterBlock.FACING) == enumdirection) { + block = Blocks.LARGE_AMETHYST_BUD; +- } else if (blockState.is(Blocks.LARGE_AMETHYST_BUD) && blockState.getValue(AmethystClusterBlock.FACING) == direction) { ++ } else if (iblockdata1.is(Blocks.LARGE_AMETHYST_BUD) && iblockdata1.getValue(AmethystClusterBlock.FACING) == enumdirection) { + block = Blocks.AMETHYST_CLUSTER; + } + + if (block != null) { +- BlockState blockState1 = block.defaultBlockState() +- .setValue(AmethystClusterBlock.FACING, direction) +- .setValue(AmethystClusterBlock.WATERLOGGED, Boolean.valueOf(blockState.getFluidState().getType() == Fluids.WATER)); +- level.setBlockAndUpdate(blockPos, blockState1); ++ IBlockData iblockdata2 = (IBlockData) ((IBlockData) block.defaultBlockState().setValue(AmethystClusterBlock.FACING, enumdirection)).setValue(AmethystClusterBlock.WATERLOGGED, iblockdata1.getFluidState().getType() == Fluids.WATER); ++ ++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(level, pos, blockposition1, iblockdata2); // CraftBukkit + } ++ + } + } + +- public static boolean canClusterGrowAtState(BlockState state) { ++ public static boolean canClusterGrowAtState(IBlockData state) { + return state.isAir() || state.is(Blocks.WATER) && state.getFluidState().getAmount() == 8; + } + } |