aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/level/block/WallHangingSignBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/level/block/WallHangingSignBlock.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/level/block/WallHangingSignBlock.java.patch254
1 files changed, 254 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/level/block/WallHangingSignBlock.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/level/block/WallHangingSignBlock.java.patch
new file mode 100644
index 0000000000..6e303e44e8
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/level/block/WallHangingSignBlock.java.patch
@@ -0,0 +1,254 @@
+--- a/net/minecraft/world/level/block/WallHangingSignBlock.java
++++ b/net/minecraft/world/level/block/WallHangingSignBlock.java
+@@ -4,13 +4,12 @@
+ import com.google.common.collect.Maps;
+ import com.mojang.serialization.MapCodec;
+ import com.mojang.serialization.codecs.RecordCodecBuilder;
+-import com.mojang.serialization.codecs.RecordCodecBuilder.Instance;
+ import java.util.Map;
+ import javax.annotation.Nullable;
+ import net.minecraft.core.BlockPos;
+ import net.minecraft.core.Direction;
+ import net.minecraft.tags.BlockTags;
+-import net.minecraft.world.InteractionHand;
++import net.minecraft.world.EnumHand;
+ import net.minecraft.world.InteractionResult;
+ import net.minecraft.world.entity.player.Player;
+ import net.minecraft.world.item.HangingSignItem;
+@@ -26,47 +25,49 @@
+ import net.minecraft.world.level.block.entity.HangingSignBlockEntity;
+ import net.minecraft.world.level.block.entity.SignBlockEntity;
+ 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.DirectionProperty;
+ import net.minecraft.world.level.block.state.properties.WoodType;
+ import net.minecraft.world.level.material.FluidState;
+ import net.minecraft.world.level.material.Fluids;
+-import net.minecraft.world.level.pathfinder.PathComputationType;
++import net.minecraft.world.level.pathfinder.PathMode;
+ import net.minecraft.world.phys.BlockHitResult;
+ import net.minecraft.world.phys.shapes.CollisionContext;
+ import net.minecraft.world.phys.shapes.Shapes;
+ import net.minecraft.world.phys.shapes.VoxelShape;
+
+ public class WallHangingSignBlock extends SignBlock {
+- public static final MapCodec<WallHangingSignBlock> CODEC = RecordCodecBuilder.mapCodec(
+- instance -> instance.group(WoodType.CODEC.fieldOf("wood_type").forGetter(SignBlock::type), propertiesCodec())
+- .apply(instance, WallHangingSignBlock::new)
+- );
++
++ public static final MapCodec<WallHangingSignBlock> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
++ return instance.group(WoodType.CODEC.fieldOf("wood_type").forGetter(SignBlock::type), propertiesCodec()).apply(instance, WallHangingSignBlock::new);
++ });
+ public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;
+- public static final VoxelShape PLANK_NORTHSOUTH = Block.box(0.0, 14.0, 6.0, 16.0, 16.0, 10.0);
+- public static final VoxelShape PLANK_EASTWEST = Block.box(6.0, 14.0, 0.0, 10.0, 16.0, 16.0);
+- public static final VoxelShape SHAPE_NORTHSOUTH = Shapes.or(PLANK_NORTHSOUTH, Block.box(1.0, 0.0, 7.0, 15.0, 10.0, 9.0));
+- public static final VoxelShape SHAPE_EASTWEST = Shapes.or(PLANK_EASTWEST, Block.box(7.0, 0.0, 1.0, 9.0, 10.0, 15.0));
+- private static final Map<Direction, VoxelShape> AABBS = Maps.newEnumMap(
+- ImmutableMap.of(Direction.NORTH, SHAPE_NORTHSOUTH, Direction.SOUTH, SHAPE_NORTHSOUTH, Direction.EAST, SHAPE_EASTWEST, Direction.WEST, SHAPE_EASTWEST)
+- );
++ public static final VoxelShape PLANK_NORTHSOUTH = Block.box(0.0D, 14.0D, 6.0D, 16.0D, 16.0D, 10.0D);
++ public static final VoxelShape PLANK_EASTWEST = Block.box(6.0D, 14.0D, 0.0D, 10.0D, 16.0D, 16.0D);
++ public static final VoxelShape SHAPE_NORTHSOUTH = Shapes.or(WallHangingSignBlock.PLANK_NORTHSOUTH, Block.box(1.0D, 0.0D, 7.0D, 15.0D, 10.0D, 9.0D));
++ public static final VoxelShape SHAPE_EASTWEST = Shapes.or(WallHangingSignBlock.PLANK_EASTWEST, Block.box(7.0D, 0.0D, 1.0D, 9.0D, 10.0D, 15.0D));
++ private static final Map<Direction, VoxelShape> AABBS = Maps.newEnumMap(ImmutableMap.of(Direction.NORTH, WallHangingSignBlock.SHAPE_NORTHSOUTH, Direction.SOUTH, WallHangingSignBlock.SHAPE_NORTHSOUTH, Direction.EAST, WallHangingSignBlock.SHAPE_EASTWEST, Direction.WEST, WallHangingSignBlock.SHAPE_EASTWEST));
+
+ @Override
+ public MapCodec<WallHangingSignBlock> codec() {
+- return CODEC;
++ return WallHangingSignBlock.CODEC;
+ }
+
+- public WallHangingSignBlock(WoodType woodType, BlockBehaviour.Properties properties) {
+- super(woodType, properties.sound(woodType.hangingSignSoundType()));
+- this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(WATERLOGGED, Boolean.valueOf(false)));
++ public WallHangingSignBlock(WoodType blockpropertywood, BlockBehaviour.Properties blockbase_info) {
++ super(blockpropertywood, blockbase_info.sound(blockpropertywood.hangingSignSoundType()));
++ this.registerDefaultState((IBlockData) ((IBlockData) ((IBlockData) this.stateDefinition.any()).setValue(WallHangingSignBlock.FACING, Direction.NORTH)).setValue(WallHangingSignBlock.WATERLOGGED, false));
+ }
+
+ @Override
+- public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
+- if (level.getBlockEntity(pos) instanceof SignBlockEntity signBlockEntity) {
+- ItemStack itemInHand = player.getItemInHand(hand);
+- if (this.shouldTryToChainAnotherHangingSign(state, player, hit, signBlockEntity, itemInHand)) {
++ public InteractionResult use(IBlockData state, Level level, BlockPos pos, Player player, EnumHand hand, BlockHitResult hit) {
++ BlockEntity tileentity = level.getBlockEntity(pos);
++
++ if (tileentity instanceof SignBlockEntity) {
++ SignBlockEntity tileentitysign = (SignBlockEntity) tileentity;
++ ItemStack itemstack = player.getItemInHand(hand);
++
++ if (this.shouldTryToChainAnotherHangingSign(state, player, hit, tileentitysign, itemstack)) {
+ return InteractionResult.PASS;
+ }
+ }
+@@ -74,14 +75,12 @@
+ return super.use(state, level, pos, player, hand, hit);
+ }
+
+- private boolean shouldTryToChainAnotherHangingSign(BlockState state, Player player, BlockHitResult hitResult, SignBlockEntity sign, ItemStack stack) {
+- return !sign.canExecuteClickCommands(sign.isFacingFrontText(player), player)
+- && stack.getItem() instanceof HangingSignItem
+- && !this.isHittingEditableSide(hitResult, state);
++ private boolean shouldTryToChainAnotherHangingSign(IBlockData state, Player player, BlockHitResult hitResult, SignBlockEntity sign, ItemStack stack) {
++ return !sign.canExecuteClickCommands(sign.isFacingFrontText(player), player) && stack.getItem() instanceof HangingSignItem && !this.isHittingEditableSide(hitResult, state);
+ }
+
+- private boolean isHittingEditableSide(BlockHitResult hitResult, BlockState state) {
+- return hitResult.getDirection().getAxis() == state.getValue(FACING).getAxis();
++ private boolean isHittingEditableSide(BlockHitResult hitResult, IBlockData state) {
++ return hitResult.getDirection().getAxis() == ((Direction) state.getValue(WallHangingSignBlock.FACING)).getAxis();
+ }
+
+ @Override
+@@ -90,54 +89,58 @@
+ }
+
+ @Override
+- public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
+- return AABBS.get(state.getValue(FACING));
++ public VoxelShape getShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) {
++ return (VoxelShape) WallHangingSignBlock.AABBS.get(state.getValue(WallHangingSignBlock.FACING));
+ }
+
+ @Override
+- public VoxelShape getBlockSupportShape(BlockState state, BlockGetter level, BlockPos pos) {
++ public VoxelShape getBlockSupportShape(IBlockData state, BlockGetter level, BlockPos pos) {
+ return this.getShape(state, level, pos, CollisionContext.empty());
+ }
+
+ @Override
+- public VoxelShape getCollisionShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
+- switch ((Direction)state.getValue(FACING)) {
++ public VoxelShape getCollisionShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) {
++ switch ((Direction) state.getValue(WallHangingSignBlock.FACING)) {
+ case EAST:
+ case WEST:
+- return PLANK_EASTWEST;
++ return WallHangingSignBlock.PLANK_EASTWEST;
+ default:
+- return PLANK_NORTHSOUTH;
++ return WallHangingSignBlock.PLANK_NORTHSOUTH;
+ }
+ }
+
+- public boolean canPlace(BlockState state, LevelReader level, BlockPos pos) {
+- Direction clockWise = state.getValue(FACING).getClockWise();
+- Direction counterClockWise = state.getValue(FACING).getCounterClockWise();
+- return this.canAttachTo(level, state, pos.relative(clockWise), counterClockWise)
+- || this.canAttachTo(level, state, pos.relative(counterClockWise), clockWise);
++ public boolean canPlace(IBlockData state, LevelReader level, BlockPos pos) {
++ Direction enumdirection = ((Direction) state.getValue(WallHangingSignBlock.FACING)).getClockWise();
++ Direction enumdirection1 = ((Direction) state.getValue(WallHangingSignBlock.FACING)).getCounterClockWise();
++
++ return this.canAttachTo(level, state, pos.relative(enumdirection), enumdirection1) || this.canAttachTo(level, state, pos.relative(enumdirection1), enumdirection);
+ }
+
+- public boolean canAttachTo(LevelReader level, BlockState state, BlockPos pos, Direction direction) {
+- BlockState blockState = level.getBlockState(pos);
+- return blockState.is(BlockTags.WALL_HANGING_SIGNS)
+- ? blockState.getValue(FACING).getAxis().test(state.getValue(FACING))
+- : blockState.isFaceSturdy(level, pos, direction, SupportType.FULL);
++ public boolean canAttachTo(LevelReader level, IBlockData state, BlockPos pos, Direction direction) {
++ IBlockData iblockdata1 = level.getBlockState(pos);
++
++ return iblockdata1.is(BlockTags.WALL_HANGING_SIGNS) ? ((Direction) iblockdata1.getValue(WallHangingSignBlock.FACING)).getAxis().test((Direction) state.getValue(WallHangingSignBlock.FACING)) : iblockdata1.isFaceSturdy(level, pos, direction, SupportType.FULL);
+ }
+
+ @Nullable
+ @Override
+- public BlockState getStateForPlacement(BlockPlaceContext context) {
+- BlockState blockState = this.defaultBlockState();
+- FluidState fluidState = context.getLevel().getFluidState(context.getClickedPos());
+- LevelReader level = context.getLevel();
+- BlockPos clickedPos = context.getClickedPos();
++ public IBlockData getStateForPlacement(BlockPlaceContext context) {
++ IBlockData iblockdata = this.defaultBlockState();
++ FluidState fluid = context.getLevel().getFluidState(context.getClickedPos());
++ 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() && !direction.getAxis().test(context.getClickedFace())) {
+- Direction opposite = direction.getOpposite();
+- blockState = blockState.setValue(FACING, opposite);
+- if (blockState.canSurvive(level, clickedPos) && this.canPlace(blockState, level, clickedPos)) {
+- return blockState.setValue(WATERLOGGED, Boolean.valueOf(fluidState.getType() == Fluids.WATER));
++ for (int j = 0; j < i; ++j) {
++ Direction enumdirection = aenumdirection[j];
++
++ if (enumdirection.getAxis().isHorizontal() && !enumdirection.getAxis().test(context.getClickedFace())) {
++ Direction enumdirection1 = enumdirection.getOpposite();
++
++ iblockdata = (IBlockData) iblockdata.setValue(WallHangingSignBlock.FACING, enumdirection1);
++ if (iblockdata.canSurvive(world, blockposition) && this.canPlace(iblockdata, world, blockposition)) {
++ return (IBlockData) iblockdata.setValue(WallHangingSignBlock.WATERLOGGED, fluid.getType() == Fluids.WATER);
+ }
+ }
+ }
+@@ -146,45 +149,43 @@
+ }
+
+ @Override
+- public BlockState updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos) {
+- return facing.getAxis() == state.getValue(FACING).getClockWise().getAxis() && !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.getAxis() == ((Direction) state.getValue(WallHangingSignBlock.FACING)).getClockWise().getAxis() && !state.canSurvive(level, currentPos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, facing, facingState, level, currentPos, facingPos);
+ }
+
+ @Override
+- public float getYRotationDegrees(BlockState state) {
+- return state.getValue(FACING).toYRot();
++ public float getYRotationDegrees(IBlockData state) {
++ return ((Direction) state.getValue(WallHangingSignBlock.FACING)).toYRot();
+ }
+
+ @Override
+- public BlockState rotate(BlockState state, Rotation rotation) {
+- return state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
++ public IBlockData rotate(IBlockData state, Rotation rotation) {
++ return (IBlockData) state.setValue(WallHangingSignBlock.FACING, rotation.rotate((Direction) state.getValue(WallHangingSignBlock.FACING)));
+ }
+
+ @Override
+- public BlockState mirror(BlockState state, Mirror mirror) {
+- return state.rotate(mirror.getRotation(state.getValue(FACING)));
++ public IBlockData mirror(IBlockData state, Mirror mirror) {
++ return state.rotate(mirror.getRotation((Direction) state.getValue(WallHangingSignBlock.FACING)));
+ }
+
+ @Override
+- protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
+- builder.add(FACING, WATERLOGGED);
++ protected void createBlockStateDefinition(StateDefinition.Builder<Block, IBlockData> builder) {
++ builder.add(WallHangingSignBlock.FACING, WallHangingSignBlock.WATERLOGGED);
+ }
+
+ @Override
+- public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
++ public BlockEntity newBlockEntity(BlockPos pos, IBlockData state) {
+ return new HangingSignBlockEntity(pos, state);
+ }
+
+ @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;
+ }
+
+ @Nullable
+ @Override
+- public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> blockEntityType) {
+- return createTickerHelper(blockEntityType, BlockEntityType.HANGING_SIGN, SignBlockEntity::tick);
++ public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, IBlockData state, BlockEntityType<T> blockEntityType) {
++ return null; // Craftbukkit - remove unnecessary sign ticking
+ }
+ }