aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/level/block/CocoaBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/level/block/CocoaBlock.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/level/block/CocoaBlock.java.patch166
1 files changed, 166 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/level/block/CocoaBlock.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/CocoaBlock.java.patch
new file mode 100644
index 0000000000..03365b03d7
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/CocoaBlock.java.patch
@@ -0,0 +1,166 @@
+--- a/net/minecraft/world/level/block/CocoaBlock.java
++++ b/net/minecraft/world/level/block/CocoaBlock.java
+@@ -13,13 +13,14 @@
+ 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.pathfinder.PathComputationType;
++import net.minecraft.world.level.pathfinder.PathMode;
+ import net.minecraft.world.phys.shapes.CollisionContext;
+ import net.minecraft.world.phys.shapes.VoxelShape;
++import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
+ public class CocoaBlock extends HorizontalDirectionalBlock implements BonemealableBlock {
+
+@@ -41,49 +42,44 @@
+ protected static final VoxelShape[] SOUTH_AABB = new VoxelShape[]{Block.box(6.0D, 7.0D, 11.0D, 10.0D, 12.0D, 15.0D), Block.box(5.0D, 5.0D, 9.0D, 11.0D, 12.0D, 15.0D), Block.box(4.0D, 3.0D, 7.0D, 12.0D, 12.0D, 15.0D)};
+
+ @Override
+- @Override
+ public MapCodec<CocoaBlock> codec() {
+ return CocoaBlock.CODEC;
+ }
+
+- public CocoaBlock(BlockBehaviour.Properties blockbehaviour_properties) {
+- super(blockbehaviour_properties);
+- this.registerDefaultState((BlockState) ((BlockState) ((BlockState) this.stateDefinition.any()).setValue(CocoaBlock.FACING, Direction.NORTH)).setValue(CocoaBlock.AGE, 0));
++ public CocoaBlock(BlockBehaviour.Properties properties) {
++ super(properties);
++ this.registerDefaultState((IBlockData) ((IBlockData) ((IBlockData) this.stateDefinition.any()).setValue(CocoaBlock.FACING, Direction.NORTH)).setValue(CocoaBlock.AGE, 0));
+ }
+
+ @Override
+- @Override
+- public boolean isRandomlyTicking(BlockState blockstate) {
+- return (Integer) blockstate.getValue(CocoaBlock.AGE) < 2;
++ public boolean isRandomlyTicking(IBlockData state) {
++ return (Integer) state.getValue(CocoaBlock.AGE) < 2;
+ }
+
+ @Override
+- @Override
+- public void randomTick(BlockState blockstate, ServerLevel serverlevel, BlockPos blockpos, RandomSource randomsource) {
+- if (serverlevel.random.nextInt(5) == 0) {
+- int i = (Integer) blockstate.getValue(CocoaBlock.AGE);
++ public void randomTick(IBlockData state, ServerLevel level, BlockPos pos, RandomSource random) {
++ if (level.random.nextInt(5) == 0) {
++ int i = (Integer) state.getValue(CocoaBlock.AGE);
+
+ if (i < 2) {
+- serverlevel.setBlock(blockpos, (BlockState) blockstate.setValue(CocoaBlock.AGE, i + 1), 2);
++ CraftEventFactory.handleBlockGrowEvent(level, pos, (IBlockData) state.setValue(CocoaBlock.AGE, i + 1), 2); // CraftBukkkit
+ }
+ }
+
+ }
+
+ @Override
+- @Override
+- public boolean canSurvive(BlockState blockstate, LevelReader levelreader, BlockPos blockpos) {
+- BlockState blockstate1 = levelreader.getBlockState(blockpos.relative((Direction) blockstate.getValue(CocoaBlock.FACING)));
++ public boolean canSurvive(IBlockData state, LevelReader level, BlockPos pos) {
++ IBlockData iblockdata1 = level.getBlockState(pos.relative((Direction) state.getValue(CocoaBlock.FACING)));
+
+- return blockstate1.is(BlockTags.JUNGLE_LOGS);
++ return iblockdata1.is(BlockTags.JUNGLE_LOGS);
+ }
+
+ @Override
+- @Override
+- public VoxelShape getShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos, CollisionContext collisioncontext) {
+- int i = (Integer) blockstate.getValue(CocoaBlock.AGE);
++ public VoxelShape getShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) {
++ int i = (Integer) state.getValue(CocoaBlock.AGE);
+
+- switch ((Direction) blockstate.getValue(CocoaBlock.FACING)) {
++ switch ((Direction) state.getValue(CocoaBlock.FACING)) {
+ case SOUTH:
+ return CocoaBlock.SOUTH_AABB[i];
+ case NORTH:
+@@ -98,21 +94,20 @@
+
+ @Nullable
+ @Override
+- @Override
+- public BlockState getStateForPlacement(BlockPlaceContext blockplacecontext) {
+- BlockState blockstate = this.defaultBlockState();
+- Level level = blockplacecontext.getLevel();
+- BlockPos blockpos = blockplacecontext.getClickedPos();
+- Direction[] adirection = blockplacecontext.getNearestLookingDirections();
+- int i = adirection.length;
++ public IBlockData getStateForPlacement(BlockPlaceContext context) {
++ IBlockData iblockdata = this.defaultBlockState();
++ Level world = context.getLevel();
++ BlockPos blockposition = context.getClickedPos();
++ Direction[] aenumdirection = context.getNearestLookingDirections();
++ int i = aenumdirection.length;
+
+ for (int j = 0; j < i; ++j) {
+- Direction direction = adirection[j];
++ Direction enumdirection = aenumdirection[j];
+
+- if (direction.getAxis().isHorizontal()) {
+- blockstate = (BlockState) blockstate.setValue(CocoaBlock.FACING, direction);
+- if (blockstate.canSurvive(level, blockpos)) {
+- return blockstate;
++ if (enumdirection.getAxis().isHorizontal()) {
++ iblockdata = (IBlockData) iblockdata.setValue(CocoaBlock.FACING, enumdirection);
++ if (iblockdata.canSurvive(world, blockposition)) {
++ return iblockdata;
+ }
+ }
+ }
+@@ -121,38 +116,32 @@
+ }
+
+ @Override
+- @Override
+- public BlockState updateShape(BlockState blockstate, Direction direction, BlockState blockstate1, LevelAccessor levelaccessor, BlockPos blockpos, BlockPos blockpos1) {
+- return direction == blockstate.getValue(CocoaBlock.FACING) && !blockstate.canSurvive(levelaccessor, blockpos) ? Blocks.AIR.defaultBlockState() : super.updateShape(blockstate, direction, blockstate1, levelaccessor, blockpos, blockpos1);
++ public IBlockData updateShape(IBlockData state, Direction facing, IBlockData facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos) {
++ return facing == state.getValue(CocoaBlock.FACING) && !state.canSurvive(level, currentPos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, facing, facingState, level, currentPos, facingPos);
+ }
+
+ @Override
+- @Override
+- public boolean isValidBonemealTarget(LevelReader levelreader, BlockPos blockpos, BlockState blockstate) {
+- return (Integer) blockstate.getValue(CocoaBlock.AGE) < 2;
++ public boolean isValidBonemealTarget(LevelReader iworldreader, BlockPos blockposition, IBlockData iblockdata) {
++ return (Integer) iblockdata.getValue(CocoaBlock.AGE) < 2;
+ }
+
+ @Override
+- @Override
+- public boolean isBonemealSuccess(Level level, RandomSource randomsource, BlockPos blockpos, BlockState blockstate) {
++ public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, IBlockData state) {
+ return true;
+ }
+
+ @Override
+- @Override
+- public void performBonemeal(ServerLevel serverlevel, RandomSource randomsource, BlockPos blockpos, BlockState blockstate) {
+- serverlevel.setBlock(blockpos, (BlockState) blockstate.setValue(CocoaBlock.AGE, (Integer) blockstate.getValue(CocoaBlock.AGE) + 1), 2);
++ public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, IBlockData state) {
++ CraftEventFactory.handleBlockGrowEvent(level, pos, (IBlockData) state.setValue(CocoaBlock.AGE, (Integer) state.getValue(CocoaBlock.AGE) + 1), 2); // CraftBukkit
+ }
+
+ @Override
+- @Override
+- protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> statedefinition_builder) {
+- statedefinition_builder.add(CocoaBlock.FACING, CocoaBlock.AGE);
++ protected void createBlockStateDefinition(StateDefinition.Builder<Block, IBlockData> builder) {
++ builder.add(CocoaBlock.FACING, CocoaBlock.AGE);
+ }
+
+ @Override
+- @Override
+- public boolean isPathfindable(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos, PathComputationType pathcomputationtype) {
++ public boolean isPathfindable(IBlockData state, BlockGetter level, BlockPos pos, PathMode type) {
+ return false;
+ }
+ }