aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/level/block/SugarCaneBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/level/block/SugarCaneBlock.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/level/block/SugarCaneBlock.java.patch133
1 files changed, 133 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/level/block/SugarCaneBlock.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/SugarCaneBlock.java.patch
new file mode 100644
index 0000000000..b69f05039b
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/SugarCaneBlock.java.patch
@@ -0,0 +1,133 @@
+--- a/net/minecraft/world/level/block/SugarCaneBlock.java
++++ b/net/minecraft/world/level/block/SugarCaneBlock.java
+@@ -12,7 +12,7 @@
+ 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;
+@@ -28,49 +28,45 @@
+ protected static final VoxelShape SHAPE = Block.box(2.0D, 0.0D, 2.0D, 14.0D, 16.0D, 14.0D);
+
+ @Override
+- @Override
+ public MapCodec<SugarCaneBlock> codec() {
+ return SugarCaneBlock.CODEC;
+ }
+
+- protected SugarCaneBlock(BlockBehaviour.Properties blockbehaviour_properties) {
+- super(blockbehaviour_properties);
+- this.registerDefaultState((BlockState) ((BlockState) this.stateDefinition.any()).setValue(SugarCaneBlock.AGE, 0));
++ protected SugarCaneBlock(BlockBehaviour.Properties properties) {
++ super(properties);
++ this.registerDefaultState((IBlockData) ((IBlockData) this.stateDefinition.any()).setValue(SugarCaneBlock.AGE, 0));
+ }
+
+ @Override
+- @Override
+- public VoxelShape getShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos, CollisionContext collisioncontext) {
++ public VoxelShape getShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) {
+ return SugarCaneBlock.SHAPE;
+ }
+
+ @Override
+- @Override
+- public void tick(BlockState blockstate, ServerLevel serverlevel, BlockPos blockpos, RandomSource randomsource) {
+- if (!blockstate.canSurvive(serverlevel, blockpos)) {
+- serverlevel.destroyBlock(blockpos, true);
++ public void tick(IBlockData state, ServerLevel level, BlockPos pos, RandomSource random) {
++ if (!state.canSurvive(level, pos)) {
++ level.destroyBlock(pos, true);
+ }
+
+ }
+
+ @Override
+- @Override
+- public void randomTick(BlockState blockstate, ServerLevel serverlevel, BlockPos blockpos, RandomSource randomsource) {
+- if (serverlevel.isEmptyBlock(blockpos.above())) {
++ public void randomTick(IBlockData state, ServerLevel level, BlockPos pos, RandomSource random) {
++ if (level.isEmptyBlock(pos.above())) {
+ int i;
+
+- for (i = 1; serverlevel.getBlockState(blockpos.below(i)).is((Block) this); ++i) {
++ for (i = 1; level.getBlockState(pos.below(i)).is((Block) this); ++i) {
+ ;
+ }
+
+ if (i < 3) {
+- int j = (Integer) blockstate.getValue(SugarCaneBlock.AGE);
++ int j = (Integer) state.getValue(SugarCaneBlock.AGE);
+
+ if (j == 15) {
+- serverlevel.setBlockAndUpdate(blockpos.above(), this.defaultBlockState());
+- serverlevel.setBlock(blockpos, (BlockState) blockstate.setValue(SugarCaneBlock.AGE, 0), 4);
++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(level, pos.above(), this.defaultBlockState()); // CraftBukkit
++ level.setBlock(pos, (IBlockData) state.setValue(SugarCaneBlock.AGE, 0), 4);
+ } else {
+- serverlevel.setBlock(blockpos, (BlockState) blockstate.setValue(SugarCaneBlock.AGE, j + 1), 4);
++ level.setBlock(pos, (IBlockData) state.setValue(SugarCaneBlock.AGE, j + 1), 4);
+ }
+ }
+ }
+@@ -78,33 +74,31 @@
+ }
+
+ @Override
+- @Override
+- public BlockState updateShape(BlockState blockstate, Direction direction, BlockState blockstate1, LevelAccessor levelaccessor, BlockPos blockpos, BlockPos blockpos1) {
+- if (!blockstate.canSurvive(levelaccessor, blockpos)) {
+- levelaccessor.scheduleTick(blockpos, (Block) this, 1);
++ public IBlockData updateShape(IBlockData state, Direction facing, IBlockData facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos) {
++ if (!state.canSurvive(level, currentPos)) {
++ level.scheduleTick(currentPos, (Block) this, 1);
+ }
+
+- return super.updateShape(blockstate, direction, blockstate1, levelaccessor, blockpos, blockpos1);
++ return super.updateShape(state, facing, facingState, level, currentPos, facingPos);
+ }
+
+ @Override
+- @Override
+- public boolean canSurvive(BlockState blockstate, LevelReader levelreader, BlockPos blockpos) {
+- BlockState blockstate1 = levelreader.getBlockState(blockpos.below());
++ public boolean canSurvive(IBlockData state, LevelReader level, BlockPos pos) {
++ IBlockData iblockdata1 = level.getBlockState(pos.below());
+
+- if (blockstate1.is((Block) this)) {
++ if (iblockdata1.is((Block) this)) {
+ return true;
+ } else {
+- if (blockstate1.is(BlockTags.DIRT) || blockstate1.is(BlockTags.SAND)) {
+- BlockPos blockpos1 = blockpos.below();
++ if (iblockdata1.is(BlockTags.DIRT) || iblockdata1.is(BlockTags.SAND)) {
++ BlockPos blockposition1 = pos.below();
+ Iterator iterator = Direction.Plane.HORIZONTAL.iterator();
+
+ while (iterator.hasNext()) {
+- Direction direction = (Direction) iterator.next();
+- BlockState blockstate2 = levelreader.getBlockState(blockpos1.relative(direction));
+- FluidState fluidstate = levelreader.getFluidState(blockpos1.relative(direction));
++ Direction enumdirection = (Direction) iterator.next();
++ IBlockData iblockdata2 = level.getBlockState(blockposition1.relative(enumdirection));
++ FluidState fluid = level.getFluidState(blockposition1.relative(enumdirection));
+
+- if (fluidstate.is(FluidTags.WATER) || blockstate2.is(Blocks.FROSTED_ICE)) {
++ if (fluid.is(FluidTags.WATER) || iblockdata2.is(Blocks.FROSTED_ICE)) {
+ return true;
+ }
+ }
+@@ -115,8 +109,7 @@
+ }
+
+ @Override
+- @Override
+- protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> statedefinition_builder) {
+- statedefinition_builder.add(SugarCaneBlock.AGE);
++ protected void createBlockStateDefinition(StateDefinition.Builder<Block, IBlockData> builder) {
++ builder.add(SugarCaneBlock.AGE);
+ }
+ }