use of net.minecraftforge.client.model.generators.MultiPartBlockStateBuilder in project Tropicraft by Tropicraft.
the class TropicraftBlockstateProvider method mangroveRoots.
private void mangroveRoots(Supplier<? extends Block> block) {
String name = name(block);
ResourceLocation roots = modBlockLoc(name);
ModelFile stem = models().withExistingParent(name(block) + "_stem", modBlockLoc("mangrove_roots/stem")).texture("roots", roots);
ModelFile stemShort = models().withExistingParent(name(block) + "_stem_short", modBlockLoc("mangrove_roots/stem_short")).texture("roots", roots);
ModelFile connectionLow = models().withExistingParent(name(block) + "_connection_low", modBlockLoc("mangrove_roots/connection_low")).texture("roots", roots);
ModelFile connectionHigh = models().withExistingParent(name(block) + "_connection_high", modBlockLoc("mangrove_roots/connection_high")).texture("roots", roots);
ModelFile appendagesHigh = models().withExistingParent(name(block) + "_appendages_high", modBlockLoc("mangrove_roots/appendages")).texture("appendages", modBlockLoc(name + "_appendages_high"));
ModelFile appendagesHighShort = models().withExistingParent(name(block) + "_appendages_high_short", modBlockLoc("mangrove_roots/appendages")).texture("appendages", modBlockLoc(name + "_appendages_high_short"));
ModelFile appendagesGrounded = models().withExistingParent(name(block) + "_appendages_ground", modBlockLoc("mangrove_roots/appendages")).texture("appendages", modBlockLoc(name + "_appendages_ground"));
ModelFile appendagesGroundedShort = models().withExistingParent(name(block) + "_appendages_ground_short", modBlockLoc("mangrove_roots/appendages")).texture("appendages", modBlockLoc(name + "_appendages_ground_short"));
MultiPartBlockStateBuilder builder = getMultipartBuilder(block.get());
builder.part().modelFile(stem).addModel().condition(MangroveRootsBlock.TALL, true);
builder.part().modelFile(stemShort).addModel().condition(MangroveRootsBlock.TALL, false);
builder.part().modelFile(appendagesGrounded).addModel().condition(MangroveRootsBlock.TALL, true).condition(MangroveRootsBlock.GROUNDED, true);
builder.part().modelFile(appendagesGroundedShort).addModel().condition(MangroveRootsBlock.TALL, false).condition(MangroveRootsBlock.GROUNDED, true);
builder.part().modelFile(appendagesHigh).addModel().condition(MangroveRootsBlock.TALL, true).condition(MangroveRootsBlock.GROUNDED, false);
builder.part().modelFile(appendagesHighShort).addModel().condition(MangroveRootsBlock.TALL, false).condition(MangroveRootsBlock.GROUNDED, false);
for (int i = 0; i < 4; i++) {
EnumProperty<MangroveRootsBlock.Connection> connection = MangroveRootsBlock.CONNECTIONS[i];
int rotation = (i * 90 + 270) % 360;
builder.part().modelFile(connectionHigh).rotationY(rotation).uvLock(true).addModel().condition(connection, MangroveRootsBlock.Connection.HIGH);
builder.part().modelFile(connectionLow).rotationY(rotation).uvLock(true).addModel().condition(connection, MangroveRootsBlock.Connection.LOW);
}
}
use of net.minecraftforge.client.model.generators.MultiPartBlockStateBuilder in project Tropicraft by Tropicraft.
the class TropicraftBlockstateProvider method boardwalk.
private void boardwalk(Supplier<? extends Block> block, ResourceLocation texture) {
ModelFile shortModel = models().withExistingParent(name(block) + "_short", modBlockLoc("boardwalk/short")).texture("planks", texture);
ModelFile shortPostModel = models().withExistingParent(name(block) + "_short_post", modBlockLoc("boardwalk/short_post")).texture("planks", texture);
ModelFile tallModel = models().withExistingParent(name(block) + "_tall", modBlockLoc("boardwalk/tall")).texture("planks", texture);
ModelFile tallPostModel = models().withExistingParent(name(block) + "_tall_post", modBlockLoc("boardwalk/tall_post")).texture("planks", texture);
ModelFile tallConnectionModel = models().withExistingParent(name(block) + "_tall_connection", modBlockLoc("boardwalk/tall_connection")).texture("planks", texture);
MultiPartBlockStateBuilder builder = getMultipartBuilder(block.get());
Direction.Axis[] horizontals = new Direction.Axis[] { Direction.Axis.X, Direction.Axis.Z };
for (Direction.Axis axis : horizontals) {
int rotation = axis == Direction.Axis.X ? 270 : 0;
builder.part().modelFile(shortModel).rotationY(rotation).uvLock(true).addModel().condition(BoardwalkBlock.TYPE, BoardwalkBlock.Type.SHORTS).condition(BoardwalkBlock.AXIS, axis);
builder.part().modelFile(tallModel).rotationY(rotation).uvLock(true).addModel().condition(BoardwalkBlock.TYPE, BoardwalkBlock.Type.TALLS).condition(BoardwalkBlock.AXIS, axis);
builder.part().modelFile(tallConnectionModel).rotationY(rotation).uvLock(true).addModel().condition(BoardwalkBlock.TYPE, BoardwalkBlock.Type.BACKS).condition(BoardwalkBlock.AXIS, axis);
builder.part().modelFile(tallConnectionModel).rotationY((rotation + 180) % 360).uvLock(true).addModel().condition(BoardwalkBlock.TYPE, BoardwalkBlock.Type.FRONTS).condition(BoardwalkBlock.AXIS, axis);
}
builder.part().modelFile(shortPostModel).addModel().condition(BoardwalkBlock.TYPE, BoardwalkBlock.Type.SHORT_POSTS);
builder.part().modelFile(tallPostModel).addModel().condition(BoardwalkBlock.TYPE, BoardwalkBlock.Type.TALL_POSTS);
}
Aggregations