aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch160
1 files changed, 160 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch
new file mode 100644
index 0000000000..4832863036
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch
@@ -0,0 +1,160 @@
+--- a/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
++++ b/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
+@@ -9,113 +9,116 @@
+ import net.minecraft.world.level.LevelAccessor;
+ 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.block.state.StateDefinition;
+ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
+ import net.minecraft.world.level.block.state.properties.IntegerProperty;
++import net.minecraft.world.level.material.Fluid;
+ import net.minecraft.world.level.material.Fluids;
+ import net.minecraft.world.phys.shapes.VoxelShape;
+
+ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements BonemealableBlock {
++
+ public static final IntegerProperty AGE = BlockStateProperties.AGE_25;
+ public static final int MAX_AGE = 25;
+ private final double growPerTickProbability;
+
+- protected GrowingPlantHeadBlock(
+- BlockBehaviour.Properties properties, Direction growthDirection, VoxelShape shape, boolean scheduleFluidTicks, double growPerTickProbability
+- ) {
++ protected GrowingPlantHeadBlock(BlockBehaviour.Properties properties, Direction growthDirection, VoxelShape shape, boolean scheduleFluidTicks, double growPerTickProbability) {
+ super(properties, growthDirection, shape, scheduleFluidTicks);
+ this.growPerTickProbability = growPerTickProbability;
+- this.registerDefaultState(this.stateDefinition.any().setValue(AGE, Integer.valueOf(0)));
++ this.registerDefaultState((IBlockData) ((IBlockData) this.stateDefinition.any()).setValue(GrowingPlantHeadBlock.AGE, 0));
+ }
+
+ @Override
+ protected abstract MapCodec<? extends GrowingPlantHeadBlock> codec();
+
+ @Override
+- public BlockState getStateForPlacement(LevelAccessor level) {
+- return this.defaultBlockState().setValue(AGE, Integer.valueOf(level.getRandom().nextInt(25)));
++ public IBlockData getStateForPlacement(LevelAccessor level) {
++ return (IBlockData) this.defaultBlockState().setValue(GrowingPlantHeadBlock.AGE, level.getRandom().nextInt(25));
+ }
+
+ @Override
+- public boolean isRandomlyTicking(BlockState state) {
+- return state.getValue(AGE) < 25;
++ public boolean isRandomlyTicking(IBlockData state) {
++ return (Integer) state.getValue(GrowingPlantHeadBlock.AGE) < 25;
+ }
+
+ @Override
+- public void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
+- if (state.getValue(AGE) < 25 && random.nextDouble() < this.growPerTickProbability) {
+- BlockPos blockPos = pos.relative(this.growthDirection);
+- if (this.canGrowInto(level.getBlockState(blockPos))) {
+- level.setBlockAndUpdate(blockPos, this.getGrowIntoState(state, level.random));
++ public void randomTick(IBlockData state, ServerLevel level, BlockPos pos, RandomSource random) {
++ if ((Integer) state.getValue(GrowingPlantHeadBlock.AGE) < 25 && random.nextDouble() < this.growPerTickProbability) {
++ BlockPos blockposition1 = pos.relative(this.growthDirection);
++
++ if (this.canGrowInto(level.getBlockState(blockposition1))) {
++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(level, pos, blockposition1, this.getGrowIntoState(state, level.random)); // CraftBukkit
+ }
+ }
++
+ }
+
+- protected BlockState getGrowIntoState(BlockState state, RandomSource random) {
+- return state.cycle(AGE);
++ protected IBlockData getGrowIntoState(IBlockData state, RandomSource random) {
++ return (IBlockData) state.cycle(GrowingPlantHeadBlock.AGE);
+ }
+
+- public BlockState getMaxAgeState(BlockState state) {
+- return state.setValue(AGE, Integer.valueOf(25));
++ public IBlockData getMaxAgeState(IBlockData state) {
++ return (IBlockData) state.setValue(GrowingPlantHeadBlock.AGE, 25);
+ }
+
+- public boolean isMaxAge(BlockState state) {
+- return state.getValue(AGE) == 25;
++ public boolean isMaxAge(IBlockData state) {
++ return (Integer) state.getValue(GrowingPlantHeadBlock.AGE) == 25;
+ }
+
+- protected BlockState updateBodyAfterConvertedFromHead(BlockState head, BlockState body) {
++ protected IBlockData updateBodyAfterConvertedFromHead(IBlockData head, IBlockData body) {
+ return body;
+ }
+
+ @Override
+- public BlockState updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos) {
++ public IBlockData updateShape(IBlockData state, Direction facing, IBlockData facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos) {
+ if (facing == this.growthDirection.getOpposite() && !state.canSurvive(level, currentPos)) {
+- level.scheduleTick(currentPos, this, 1);
++ level.scheduleTick(currentPos, (Block) this, 1);
+ }
+
+- if (facing != this.growthDirection || !facingState.is(this) && !facingState.is(this.getBodyBlock())) {
++ if (facing == this.growthDirection && (facingState.is((Block) this) || facingState.is(this.getBodyBlock()))) {
++ return this.updateBodyAfterConvertedFromHead(state, this.getBodyBlock().defaultBlockState());
++ } else {
+ if (this.scheduleFluidTicks) {
+- level.scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickDelay(level));
++ level.scheduleTick(currentPos, (Fluid) Fluids.WATER, Fluids.WATER.getTickDelay(level));
+ }
+
+ return super.updateShape(state, facing, facingState, level, currentPos, facingPos);
+- } else {
+- return this.updateBodyAfterConvertedFromHead(state, this.getBodyBlock().defaultBlockState());
+ }
+ }
+
+ @Override
+- protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
+- builder.add(AGE);
++ protected void createBlockStateDefinition(StateDefinition.Builder<Block, IBlockData> builder) {
++ builder.add(GrowingPlantHeadBlock.AGE);
+ }
+
+ @Override
+- public boolean isValidBonemealTarget(LevelReader levelReader, BlockPos blockPos, BlockState blockState) {
+- return this.canGrowInto(levelReader.getBlockState(blockPos.relative(this.growthDirection)));
++ public boolean isValidBonemealTarget(LevelReader iworldreader, BlockPos blockposition, IBlockData iblockdata) {
++ return this.canGrowInto(iworldreader.getBlockState(blockposition.relative(this.growthDirection)));
+ }
+
+ @Override
+- public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, BlockState state) {
++ public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, IBlockData state) {
+ return true;
+ }
+
+ @Override
+- public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) {
+- BlockPos blockPos = pos.relative(this.growthDirection);
+- int min = Math.min(state.getValue(AGE) + 1, 25);
+- int blocksToGrowWhenBonemealed = this.getBlocksToGrowWhenBonemealed(random);
++ public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, IBlockData state) {
++ BlockPos blockposition1 = pos.relative(this.growthDirection);
++ int i = Math.min((Integer) state.getValue(GrowingPlantHeadBlock.AGE) + 1, 25);
++ int j = this.getBlocksToGrowWhenBonemealed(random);
+
+- for (int i = 0; i < blocksToGrowWhenBonemealed && this.canGrowInto(level.getBlockState(blockPos)); i++) {
+- level.setBlockAndUpdate(blockPos, state.setValue(AGE, Integer.valueOf(min)));
+- blockPos = blockPos.relative(this.growthDirection);
+- min = Math.min(min + 1, 25);
++ for (int k = 0; k < j && this.canGrowInto(level.getBlockState(blockposition1)); ++k) {
++ level.setBlockAndUpdate(blockposition1, (IBlockData) state.setValue(GrowingPlantHeadBlock.AGE, i));
++ blockposition1 = blockposition1.relative(this.growthDirection);
++ i = Math.min(i + 1, 25);
+ }
++
+ }
+
+ protected abstract int getBlocksToGrowWhenBonemealed(RandomSource random);
+
+- protected abstract boolean canGrowInto(BlockState state);
++ protected abstract boolean canGrowInto(IBlockData state);
+
+ @Override
+ protected GrowingPlantHeadBlock getHeadBlock() {