diff --git a/src/main/java/com/simibubi/create/AllSpriteShifts.java b/src/main/java/com/simibubi/create/AllSpriteShifts.java index 9aafdc586..650c1d6ab 100644 --- a/src/main/java/com/simibubi/create/AllSpriteShifts.java +++ b/src/main/java/com/simibubi/create/AllSpriteShifts.java @@ -44,7 +44,10 @@ public class AllSpriteShifts { SHADOW_STEEL_CASING = omni("shadow_steel_casing"), REFINED_RADIANCE_CASING = omni("refined_radiance_casing"), CREATIVE_CASING = getCT(CTType.CROSS, "creative_casing"); - public static final CTSpriteShiftEntry CHASSIS = getCT(CTType.OMNIDIRECTIONAL, "linear_chassis_end"), + public static final CTSpriteShiftEntry + CHASSIS_SIDE = getCT(CTType.OMNIDIRECTIONAL, "linear_chassis_side"), + SECONDARY_CHASSIS_SIDE = getCT(CTType.OMNIDIRECTIONAL, "secondary_linear_chassis_side"), + CHASSIS = getCT(CTType.OMNIDIRECTIONAL, "linear_chassis_end"), CHASSIS_STICKY = getCT(CTType.OMNIDIRECTIONAL, "linear_chassis_end_sticky"); public static final CTSpriteShiftEntry BRASS_TUNNEL_TOP = vertical("brass_tunnel_top"), diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/ChassisTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/ChassisTileEntity.java index 1f8396922..0c21d2b83 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/ChassisTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/ChassisTileEntity.java @@ -125,8 +125,6 @@ public class ChassisTileEntity extends SmartTileEntity { // Collect group of connected linear chassis for (Direction offset : Iterate.directions) { - if (offset.getAxis() == axis) - continue; BlockPos current = pos.offset(offset); if (visited.contains(current)) continue; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/LinearChassisBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/LinearChassisBlock.java index 30c6f95db..7450247d2 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/LinearChassisBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/LinearChassisBlock.java @@ -73,14 +73,49 @@ public class LinearChassisBlock extends AbstractChassisBlock { Block block = state.getBlock(); BooleanProperty glueableSide = ((LinearChassisBlock) block).getGlueableSide(state, direction); if (glueableSide == null) - return null; + return AllBlocks.LINEAR_CHASSIS.has(state) ? AllSpriteShifts.CHASSIS_SIDE + : AllSpriteShifts.SECONDARY_CHASSIS_SIDE; return state.get(glueableSide) ? AllSpriteShifts.CHASSIS_STICKY : AllSpriteShifts.CHASSIS; } + @Override + protected Direction getUpDirection(ILightReader reader, BlockPos pos, BlockState state, Direction face) { + Axis axis = state.get(AXIS); + if (face.getAxis() == axis) + return super.getUpDirection(reader, pos, state, face); + return Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis); + } + + @Override + protected Direction getRightDirection(ILightReader reader, BlockPos pos, BlockState state, Direction face) { + Axis axis = state.get(AXIS); + return axis != face.getAxis() && axis.isHorizontal() ? (face.getAxis() + .isHorizontal() ? Direction.DOWN : (axis == Axis.X ? Direction.NORTH : Direction.EAST)) + : super.getRightDirection(reader, pos, state, face); + } + + @Override + protected boolean reverseUVsHorizontally(BlockState state, Direction face) { + Axis axis = state.get(AXIS); + boolean side = face.getAxis() != axis; + if (side && axis == Axis.X && face.getAxis() + .isHorizontal()) + return true; + return super.reverseUVsHorizontally(state, face); + } + + @Override + protected boolean reverseUVsVertically(BlockState state, Direction face) { + return super.reverseUVsVertically(state, face); + } + @Override public boolean reverseUVs(BlockState state, Direction face) { Axis axis = state.get(AXIS); - if (axis.isHorizontal() && (face.getAxisDirection() == AxisDirection.POSITIVE)) + boolean end = face.getAxis() == axis; + if (end && axis.isHorizontal() && (face.getAxisDirection() == AxisDirection.POSITIVE)) + return true; + if (!end && axis.isHorizontal() && face == Direction.DOWN) return true; return super.reverseUVs(state, face); } @@ -88,7 +123,10 @@ public class LinearChassisBlock extends AbstractChassisBlock { @Override public boolean connectsTo(BlockState state, BlockState other, ILightReader reader, BlockPos pos, BlockPos otherPos, Direction face) { - return sameKind(state, other) && state.get(AXIS) == other.get(AXIS); + Axis axis = state.get(AXIS); + boolean superConnect = face.getAxis() == axis ? super.connectsTo(state, other, reader, pos, otherPos, face) + : sameKind(state, other); + return superConnect && axis == other.get(AXIS); } } diff --git a/src/main/java/com/simibubi/create/foundation/block/connected/ConnectedTextureBehaviour.java b/src/main/java/com/simibubi/create/foundation/block/connected/ConnectedTextureBehaviour.java index 5b9edc03b..64e655d9c 100644 --- a/src/main/java/com/simibubi/create/foundation/block/connected/ConnectedTextureBehaviour.java +++ b/src/main/java/com/simibubi/create/foundation/block/connected/ConnectedTextureBehaviour.java @@ -55,10 +55,9 @@ public abstract class ConnectedTextureBehaviour { if (textureEntry == null) return context; - Axis axis = face.getAxis(); boolean positive = face.getAxisDirection() == AxisDirection.POSITIVE; - Direction h = axis == Axis.X ? Direction.SOUTH : Direction.WEST; - Direction v = axis.isHorizontal() ? Direction.UP : Direction.NORTH; + Direction h = getRightDirection(reader, pos, state, face); + Direction v = getUpDirection(reader, pos, state, face); h = positive ? h.getOpposite() : h; if (face == Direction.DOWN) { v = v.getOpposite(); @@ -95,6 +94,16 @@ public abstract class ConnectedTextureBehaviour { return context; } + protected Direction getUpDirection(ILightReader reader, BlockPos pos, BlockState state, Direction face) { + Axis axis = face.getAxis(); + return axis.isHorizontal() ? Direction.UP : Direction.NORTH; + } + + protected Direction getRightDirection(ILightReader reader, BlockPos pos, BlockState state, Direction face) { + Axis axis = face.getAxis(); + return axis == Axis.X ? Direction.SOUTH : Direction.WEST; + } + private boolean testConnection(ILightReader reader, BlockPos pos, BlockState state, Direction face, final Direction horizontal, final Direction vertical, int sh, int sv) { BlockPos p = pos.offset(horizontal, sh) diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/BearingScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/BearingScenes.java index 01ac69c20..689a14165 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/BearingScenes.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/BearingScenes.java @@ -431,6 +431,8 @@ public class BearingScenes { public static void clockwork(SceneBuilder scene, SceneBuildingUtil util) { scene.title("clockwork_bearing", "Animating Structures using Clockwork Bearings"); + scene.configureBasePlate(1, 1, 5); + scene.setSceneOffsetY(-1); Selection kinetics = util.select.fromTo(3, 3, 4, 3, 1, 6); Selection largeCog = util.select.position(2, 0, 6); diff --git a/src/main/resources/assets/create/textures/block/linear_chassis_side_connected.png b/src/main/resources/assets/create/textures/block/linear_chassis_side_connected.png new file mode 100644 index 000000000..b1398a957 Binary files /dev/null and b/src/main/resources/assets/create/textures/block/linear_chassis_side_connected.png differ diff --git a/src/main/resources/assets/create/textures/block/secondary_linear_chassis_side_connected.png b/src/main/resources/assets/create/textures/block/secondary_linear_chassis_side_connected.png new file mode 100644 index 000000000..dc7fb57d7 Binary files /dev/null and b/src/main/resources/assets/create/textures/block/secondary_linear_chassis_side_connected.png differ