Captain Distracto, Part II
- Linear Chassis now connect to each other in any direction
This commit is contained in:
parent
d38f49fab6
commit
2a8c3debeb
7 changed files with 59 additions and 9 deletions
|
@ -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"),
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Loading…
Reference in a new issue