use of com.tterrag.registrate.util.nullness.NonNullBiConsumer in project Create by Creators-of-Create.
the class BlockStateGen method cartAssembler.
public static NonNullBiConsumer<DataGenContext<Block, CartAssemblerBlock>, RegistrateBlockstateProvider> cartAssembler() {
return (c, p) -> p.getVariantBuilder(c.get()).forAllStates(state -> {
CartAssembleRailType type = state.getValue(CartAssemblerBlock.RAIL_TYPE);
Boolean powered = state.getValue(CartAssemblerBlock.POWERED);
Boolean backwards = state.getValue(CartAssemblerBlock.BACKWARDS);
RailShape shape = state.getValue(CartAssemblerBlock.RAIL_SHAPE);
int yRotation = shape == RailShape.EAST_WEST ? 270 : 0;
if (backwards)
yRotation += 180;
return ConfiguredModel.builder().modelFile(p.models().getExistingFile(p.modLoc("block/" + c.getName() + "/block_" + type.getSerializedName() + (powered ? "_powered" : "")))).rotationY(yRotation % 360).build();
});
}
use of com.tterrag.registrate.util.nullness.NonNullBiConsumer in project Create by Creators-of-Create.
the class BlockStateGen method encasedPipe.
public static <P extends EncasedPipeBlock> NonNullBiConsumer<DataGenContext<Block, P>, RegistrateBlockstateProvider> encasedPipe() {
return (c, p) -> {
ModelFile open = AssetLookup.partialBaseModel(c, p, "open");
ModelFile flat = AssetLookup.partialBaseModel(c, p, "flat");
MultiPartBlockStateBuilder builder = p.getMultipartBuilder(c.get());
for (boolean flatPass : Iterate.trueAndFalse) for (Direction d : Iterate.directions) {
int verticalAngle = d == Direction.UP ? 90 : d == Direction.DOWN ? -90 : 0;
builder.part().modelFile(flatPass ? flat : open).rotationX(verticalAngle).rotationY((int) (d.toYRot() + (d.getAxis().isVertical() ? 90 : 0)) % 360).addModel().condition(EncasedPipeBlock.FACING_TO_PROPERTY_MAP.get(d), !flatPass).end();
}
};
}
use of com.tterrag.registrate.util.nullness.NonNullBiConsumer in project Create by Creators-of-Create.
the class WindowGen method connectedGlassPane.
private static BlockEntry<ConnectedGlassPaneBlock> connectedGlassPane(String name, Supplier<? extends Block> parent, Supplier<CTSpriteShiftEntry> ctshift, ResourceLocation sideTexture, ResourceLocation itemSideTexture, ResourceLocation topTexture, Supplier<Supplier<RenderType>> renderType) {
NonNullConsumer<? super ConnectedGlassPaneBlock> connectedTextures = connectedTextures(() -> new GlassPaneCTBehaviour(ctshift.get()));
String CGPparents = "block/connected_glass_pane/";
String prefix = name + "_pane_";
Function<RegistrateBlockstateProvider, ModelFile> post = getPaneModelProvider(CGPparents, prefix, "post", sideTexture, topTexture), side = getPaneModelProvider(CGPparents, prefix, "side", sideTexture, topTexture), sideAlt = getPaneModelProvider(CGPparents, prefix, "side_alt", sideTexture, topTexture), noSide = getPaneModelProvider(CGPparents, prefix, "noside", sideTexture, topTexture), noSideAlt = getPaneModelProvider(CGPparents, prefix, "noside_alt", sideTexture, topTexture);
NonNullBiConsumer<DataGenContext<Block, ConnectedGlassPaneBlock>, RegistrateBlockstateProvider> stateProvider = (c, p) -> p.paneBlock(c.get(), post.apply(p), side.apply(p), sideAlt.apply(p), noSide.apply(p), noSideAlt.apply(p));
return glassPane(name, parent, itemSideTexture, topTexture, ConnectedGlassPaneBlock::new, renderType, connectedTextures, stateProvider);
}
Aggregations