From de63fccf434e3931134031b3a2f44075f7cc2b0f Mon Sep 17 00:00:00 2001 From: Darkere Date: Sun, 14 Nov 2021 21:58:31 +0100 Subject: [PATCH] continue rotating if block points into cover --- .../refinedmods/refinedstorage/block/CableBlock.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/com/refinedmods/refinedstorage/block/CableBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/CableBlock.java index 8d2d2773c..2e6d9e1e4 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/CableBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/CableBlock.java @@ -22,6 +22,7 @@ import net.minecraft.state.BooleanProperty; import net.minecraft.state.StateContainer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; +import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; @@ -126,6 +127,16 @@ public class CableBlock extends NetworkNodeBlock implements IWaterLoggable { // Ideally, this code would be in rotate(). But rotate() doesn't have any data about the position and world, so we need to do it here. world.setBlockState(pos, getState(world.getBlockState(pos), world, pos)); + + //when rotating skip rotations blocked by covers + BlockDirection dir = getDirection(); + if (dir != BlockDirection.NONE) { + if (isSideCovered(world.getTileEntity(pos), newDirection)) { + BlockState newState = rotate(world.getBlockState(pos), Rotation.CLOCKWISE_90); + world.setBlockState(pos, newState); + } + } + super.onDirectionChanged(world, pos, newDirection); }