use of com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelBlock.Shape in project Create by Creators-of-Create.
the class BeltTunnelTileEntity method updateTunnelConnections.
public void updateTunnelConnections() {
flaps.clear();
sides.clear();
BlockState tunnelState = getBlockState();
for (Direction direction : Iterate.horizontalDirections) {
if (direction.getAxis() != tunnelState.getValue(BlockStateProperties.HORIZONTAL_AXIS)) {
boolean positive = direction.getAxisDirection() == AxisDirection.POSITIVE ^ direction.getAxis() == Axis.Z;
Shape shape = tunnelState.getValue(BeltTunnelBlock.SHAPE);
if (BeltTunnelBlock.isStraight(tunnelState))
continue;
if (positive && shape == Shape.T_LEFT)
continue;
if (!positive && shape == Shape.T_RIGHT)
continue;
}
sides.add(direction);
// Flap might be occluded
BlockState nextState = level.getBlockState(worldPosition.relative(direction));
if (nextState.getBlock() instanceof BeltTunnelBlock)
continue;
if (nextState.getBlock() instanceof BeltFunnelBlock)
if (nextState.getValue(BeltFunnelBlock.SHAPE) == BeltFunnelBlock.Shape.EXTENDED && nextState.getValue(BeltFunnelBlock.HORIZONTAL_FACING) == direction.getOpposite())
continue;
flaps.put(direction, new InterpolatedChasingValue().start(.25f).target(0).withSpeed(.05f));
}
sendData();
}
use of com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelBlock.Shape in project Create by Creators-of-Create.
the class BuilderTransformers method beltTunnel.
public static <B extends BeltTunnelBlock> NonNullUnaryOperator<BlockBuilder<B, CreateRegistrate>> beltTunnel(String type, ResourceLocation particleTexture) {
return b -> b.initialProperties(SharedProperties::stone).addLayer(() -> RenderType::cutoutMipped).properties(BlockBehaviour.Properties::noOcclusion).transform(pickaxeOnly()).blockstate((c, p) -> p.getVariantBuilder(c.get()).forAllStates(state -> {
String id = "block/" + type + "_tunnel";
Shape shape = state.getValue(BeltTunnelBlock.SHAPE);
if (shape == BeltTunnelBlock.Shape.CLOSED)
shape = BeltTunnelBlock.Shape.STRAIGHT;
String shapeName = shape.getSerializedName();
return ConfiguredModel.builder().modelFile(p.models().withExistingParent(id + "/" + shapeName, p.modLoc("block/belt_tunnel/" + shapeName)).texture("1", p.modLoc(id + "_top")).texture("2", p.modLoc(id)).texture("3", p.modLoc(id + "_top_window")).texture("particle", particleTexture)).rotationY(state.getValue(BeltTunnelBlock.HORIZONTAL_AXIS) == Axis.X ? 0 : 90).build();
})).item(BeltTunnelItem::new).model((c, p) -> {
String id = type + "_tunnel";
p.withExistingParent("item/" + id, p.modLoc("block/belt_tunnel/item")).texture("1", p.modLoc("block/" + id + "_top")).texture("2", p.modLoc("block/" + id)).texture("particle", particleTexture);
}).build();
}
Aggregations