diff options
author | MiniDigger | Martin <[email protected]> | 2024-01-14 11:04:49 +0100 |
---|---|---|
committer | MiniDigger | Martin <[email protected]> | 2024-01-14 11:04:49 +0100 |
commit | bee74680e607c2e29b038329f62181238911cd83 (patch) | |
tree | 708fd1a4a0227d9071243adf2a42d5e9e96cde4a /patch-remap/mache-vineflower/net/minecraft/world/level/block/CocoaBlock.java.patch | |
parent | 0a44692ef6ff6e255d48eb3ba1bb114166eafda9 (diff) | |
download | Paper-softspoon.tar.gz Paper-softspoon.zip |
add remapped patches as a testsoftspoon
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/level/block/CocoaBlock.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower/net/minecraft/world/level/block/CocoaBlock.java.patch | 184 |
1 files changed, 184 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/level/block/CocoaBlock.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/level/block/CocoaBlock.java.patch new file mode 100644 index 0000000000..2cbafc1f7a --- /dev/null +++ b/patch-remap/mache-vineflower/net/minecraft/world/level/block/CocoaBlock.java.patch @@ -0,0 +1,184 @@ +--- a/net/minecraft/world/level/block/CocoaBlock.java ++++ b/net/minecraft/world/level/block/CocoaBlock.java +@@ -13,15 +13,17 @@ + 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 { ++ + public static final MapCodec<CocoaBlock> CODEC = simpleCodec(CocoaBlock::new); + public static final int MAX_AGE = 2; + public static final IntegerProperty AGE = BlockStateProperties.AGE_2; +@@ -34,78 +36,78 @@ + protected static final int AGE_2_WIDTH = 8; + protected static final int AGE_2_HEIGHT = 9; + protected static final int AGE_2_HALFWIDTH = 4; +- protected static final VoxelShape[] EAST_AABB = new VoxelShape[]{ +- Block.box(11.0, 7.0, 6.0, 15.0, 12.0, 10.0), Block.box(9.0, 5.0, 5.0, 15.0, 12.0, 11.0), Block.box(7.0, 3.0, 4.0, 15.0, 12.0, 12.0) +- }; +- protected static final VoxelShape[] WEST_AABB = new VoxelShape[]{ +- Block.box(1.0, 7.0, 6.0, 5.0, 12.0, 10.0), Block.box(1.0, 5.0, 5.0, 7.0, 12.0, 11.0), Block.box(1.0, 3.0, 4.0, 9.0, 12.0, 12.0) +- }; +- protected static final VoxelShape[] NORTH_AABB = new VoxelShape[]{ +- Block.box(6.0, 7.0, 1.0, 10.0, 12.0, 5.0), Block.box(5.0, 5.0, 1.0, 11.0, 12.0, 7.0), Block.box(4.0, 3.0, 1.0, 12.0, 12.0, 9.0) +- }; +- protected static final VoxelShape[] SOUTH_AABB = new VoxelShape[]{ +- Block.box(6.0, 7.0, 11.0, 10.0, 12.0, 15.0), Block.box(5.0, 5.0, 9.0, 11.0, 12.0, 15.0), Block.box(4.0, 3.0, 7.0, 12.0, 12.0, 15.0) +- }; ++ protected static final VoxelShape[] EAST_AABB = new VoxelShape[]{Block.box(11.0D, 7.0D, 6.0D, 15.0D, 12.0D, 10.0D), Block.box(9.0D, 5.0D, 5.0D, 15.0D, 12.0D, 11.0D), Block.box(7.0D, 3.0D, 4.0D, 15.0D, 12.0D, 12.0D)}; ++ protected static final VoxelShape[] WEST_AABB = new VoxelShape[]{Block.box(1.0D, 7.0D, 6.0D, 5.0D, 12.0D, 10.0D), Block.box(1.0D, 5.0D, 5.0D, 7.0D, 12.0D, 11.0D), Block.box(1.0D, 3.0D, 4.0D, 9.0D, 12.0D, 12.0D)}; ++ protected static final VoxelShape[] NORTH_AABB = new VoxelShape[]{Block.box(6.0D, 7.0D, 1.0D, 10.0D, 12.0D, 5.0D), Block.box(5.0D, 5.0D, 1.0D, 11.0D, 12.0D, 7.0D), Block.box(4.0D, 3.0D, 1.0D, 12.0D, 12.0D, 9.0D)}; ++ 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 + public MapCodec<CocoaBlock> codec() { +- return CODEC; ++ return CocoaBlock.CODEC; + } + + public CocoaBlock(BlockBehaviour.Properties properties) { + super(properties); +- this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(AGE, Integer.valueOf(0))); ++ this.registerDefaultState((IBlockData) ((IBlockData) ((IBlockData) this.stateDefinition.any()).setValue(CocoaBlock.FACING, Direction.NORTH)).setValue(CocoaBlock.AGE, 0)); + } + + @Override +- public boolean isRandomlyTicking(BlockState state) { +- return state.getValue(AGE) < 2; ++ public boolean isRandomlyTicking(IBlockData state) { ++ return (Integer) state.getValue(CocoaBlock.AGE) < 2; + } + + @Override +- public void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { ++ public void randomTick(IBlockData state, ServerLevel level, BlockPos pos, RandomSource random) { + if (level.random.nextInt(5) == 0) { +- int i = state.getValue(AGE); ++ int i = (Integer) state.getValue(CocoaBlock.AGE); ++ + if (i < 2) { +- level.setBlock(pos, state.setValue(AGE, Integer.valueOf(i + 1)), 2); ++ CraftEventFactory.handleBlockGrowEvent(level, pos, (IBlockData) state.setValue(CocoaBlock.AGE, i + 1), 2); // CraftBukkkit + } + } ++ + } + + @Override +- public boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) { +- BlockState blockState = level.getBlockState(pos.relative(state.getValue(FACING))); +- return blockState.is(BlockTags.JUNGLE_LOGS); ++ public boolean canSurvive(IBlockData state, LevelReader level, BlockPos pos) { ++ IBlockData iblockdata1 = level.getBlockState(pos.relative((Direction) state.getValue(CocoaBlock.FACING))); ++ ++ return iblockdata1.is(BlockTags.JUNGLE_LOGS); + } + + @Override +- public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { +- int i = state.getValue(AGE); +- switch ((Direction)state.getValue(FACING)) { ++ public VoxelShape getShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) { ++ int i = (Integer) state.getValue(CocoaBlock.AGE); ++ ++ switch ((Direction) state.getValue(CocoaBlock.FACING)) { + case SOUTH: +- return SOUTH_AABB[i]; ++ return CocoaBlock.SOUTH_AABB[i]; + case NORTH: + default: +- return NORTH_AABB[i]; ++ return CocoaBlock.NORTH_AABB[i]; + case WEST: +- return WEST_AABB[i]; ++ return CocoaBlock.WEST_AABB[i]; + case EAST: +- return EAST_AABB[i]; ++ return CocoaBlock.EAST_AABB[i]; + } + } + + @Nullable + @Override +- public BlockState getStateForPlacement(BlockPlaceContext context) { +- BlockState blockState = this.defaultBlockState(); +- LevelReader level = context.getLevel(); +- BlockPos clickedPos = context.getClickedPos(); ++ 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 (Direction direction : context.getNearestLookingDirections()) { +- if (direction.getAxis().isHorizontal()) { +- blockState = blockState.setValue(FACING, direction); +- if (blockState.canSurvive(level, clickedPos)) { +- return blockState; ++ for (int j = 0; j < i; ++j) { ++ Direction enumdirection = aenumdirection[j]; ++ ++ if (enumdirection.getAxis().isHorizontal()) { ++ iblockdata = (IBlockData) iblockdata.setValue(CocoaBlock.FACING, enumdirection); ++ if (iblockdata.canSurvive(world, blockposition)) { ++ return iblockdata; + } + } + } +@@ -114,34 +116,32 @@ + } + + @Override +- public BlockState updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos) { +- return facing == state.getValue(FACING) && !state.canSurvive(level, currentPos) +- ? Blocks.AIR.defaultBlockState() +- : super.updateShape(state, facing, facingState, level, currentPos, facingPos); ++ 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 +- public boolean isValidBonemealTarget(LevelReader levelReader, BlockPos blockPos, BlockState blockState) { +- return blockState.getValue(AGE) < 2; ++ public boolean isValidBonemealTarget(LevelReader iworldreader, BlockPos blockposition, IBlockData iblockdata) { ++ return (Integer) iblockdata.getValue(CocoaBlock.AGE) < 2; + } + + @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) { +- level.setBlock(pos, state.setValue(AGE, Integer.valueOf(state.getValue(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 +- protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) { +- builder.add(FACING, AGE); ++ protected void createBlockStateDefinition(StateDefinition.Builder<Block, IBlockData> builder) { ++ builder.add(CocoaBlock.FACING, CocoaBlock.AGE); + } + + @Override +- public boolean isPathfindable(BlockState state, BlockGetter level, BlockPos pos, PathComputationType type) { ++ public boolean isPathfindable(IBlockData state, BlockGetter level, BlockPos pos, PathMode type) { + return false; + } + } |