diff --git a/src/main/java/dev/dubhe/anvilcraft/block/FishTankBlock.java b/src/main/java/dev/dubhe/anvilcraft/block/FishTankBlock.java index 6c2df2ad4d..9ab6767baf 100644 --- a/src/main/java/dev/dubhe/anvilcraft/block/FishTankBlock.java +++ b/src/main/java/dev/dubhe/anvilcraft/block/FishTankBlock.java @@ -34,6 +34,8 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -109,6 +111,16 @@ public BlockState getStateForPlacement(BlockPlaceContext context) { return this.defaultBlockState().setValue(FishTankBlock.FACING, facing); } + @Override + protected BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); + } + + @Override + protected BlockState mirror(BlockState state, Mirror mirror) { + return state.setValue(FACING, mirror.mirror(state.getValue(FACING))); + } + @Override protected boolean hasAnalogOutputSignal(BlockState state) { return true; diff --git a/src/main/java/dev/dubhe/anvilcraft/block/OverflowChuteBlock.java b/src/main/java/dev/dubhe/anvilcraft/block/OverflowChuteBlock.java index c2b15d1333..3c30876f7f 100644 --- a/src/main/java/dev/dubhe/anvilcraft/block/OverflowChuteBlock.java +++ b/src/main/java/dev/dubhe/anvilcraft/block/OverflowChuteBlock.java @@ -340,12 +340,28 @@ public int getAnalogOutputSignal(BlockState blockState, Level level, BlockPos bl @Override public BlockState rotate(BlockState state, Rotation rotation) { - return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); + BlockState result = state.setValue(FACING, rotation.rotate(state.getValue(FACING))); + for (Direction direction : Direction.values()) { + Direction rotatedDirection = rotation.rotate(direction); + result = result.setValue( + overflowProperty(rotatedDirection), + state.getValue(overflowProperty(direction)) + ); + } + return result; } @Override public BlockState mirror(BlockState state, Mirror mirror) { - return this.rotate(state, mirror.getRotation(state.getValue(FACING))); + BlockState result = state.setValue(FACING, mirror.mirror(state.getValue(FACING))); + for (Direction direction : Direction.values()) { + Direction mirroredDirection = mirror.mirror(direction); + result = result.setValue( + overflowProperty(mirroredDirection), + state.getValue(overflowProperty(direction)) + ); + } + return result; } @Override