From 2a8c3debeb0330ae8f8f6dba01a00e292a460ecf Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Thu, 11 Mar 2021 19:51:58 +0100 Subject: [PATCH] Captain Distracto, Part II - Linear Chassis now connect to each other in any direction --- .../com/simibubi/create/AllSpriteShifts.java | 5 +- .../chassis/ChassisTileEntity.java | 2 - .../chassis/LinearChassisBlock.java | 44 ++++++++++++++++-- .../connected/ConnectedTextureBehaviour.java | 15 ++++-- .../ponder/content/BearingScenes.java | 2 + .../block/linear_chassis_side_connected.png | Bin 0 -> 2405 bytes ...econdary_linear_chassis_side_connected.png | Bin 0 -> 1986 bytes 7 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 src/main/resources/assets/create/textures/block/linear_chassis_side_connected.png create mode 100644 src/main/resources/assets/create/textures/block/secondary_linear_chassis_side_connected.png 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 0000000000000000000000000000000000000000..b1398a95747e97b9c096ca390a6196e19b9a0c99 GIT binary patch literal 2405 zcmZuzXH-+!77heNjSx@~1zv(;8Apd=89D(01EN$BQ3!PqhbVP|LK=+E0!xY_;UP^J z1yl%~AP}NBhN6TL1tkz^h8{J961d4balIe!$K18f-S_OT+`Z4fKkgkj7p&@L?aeS4 zOx4NJ-UCFcd~Jk-`{L(}RS*(($LIKNz)DR`rBbN`0>KES=47aa$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*v@&G13!G}M)8?D{Snl1q^1A2 z#vDk!gb(vW+obO$3VF&dtqL!!1EN1fP4Bgi%K)qjB%^rrq7`de<^`~))_TIj{22wD zj2;yjn|A+UGQ|JRfPR@xyZ|1C2Ha*yWzl;;5v;(ICYG_wp zv3wAlQA&9roP-d$WVrT#CwZG^7nXr zv%ZcBm`@I_z;sTV=#>e>p_5#lrY|m6kx>#=)@|(dpT`1ch*^9l%Iy!UsfKcqkG%V* z7Z!eXZ`EY?%G<7}xMh6LR}(s?+rasbDMNB+WI5wEUY`s@NAabD@iteh{_6Ckhp#V* zsl2hW3o`!7{H(%;T{s*)oTto{4=^5;UiCCGmLMN;z6#;{Nc6z8JWt-3gi9;_vb4%F zoq?oL@(e27*8xteF=mJSKL2|wB?%~+;06Ox&n5~PQ;k*6An7JRGuW81--VvBKjy7N zYq`~PEf+BRNZZ>R+TBfGUGea(eL46(epCs3Mq3n$biD<8G*#zBuyF6$e{Tb4RZmKs zxO|5HGQuBu9x|A*U{v#~P%Nj%d-7qAn0y?X<<)3O^5V-Xt*JIIXVbt`xdmG1rKcV$mhh<(kz&{5{uQ1rC{rv@&eG4W z9YK#T>bQ|`0cJ^?KQX7*+yV3+K+hniZ{PoTYC70c2TAfF6-t^}(GxYCaQphHA5`FS zQ@@;ua}FtPlh3+vKg>^QyD274=N=!){ijHvxSk(d=Us6mW8B97FQ$uOd$+A>3-F1e zm4F3jeH literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..dc7fb57d72df2e734850da1fde25de978911c339 GIT binary patch literal 1986 zcmZuydpMNq7XM02*oXxQVH+n_jNhG@pE|9)22n2$Ysa60^FZ}$$hzo|-JdP4i{R2SK)6)|Y63ApS-a;oVEG#fEFx1f?mT-hf zBoZutO7bKL*k zvD;_}RGC(8HPksy=nXhPL}RQsBa^6!fLHV?bljVv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