use of com.tterrag.registrate.builders.BlockBuilder in project Create by Creators-of-Create.
the class CopperBlockSet method createEntry.
protected <T extends Block> BlockEntry<?> createEntry(AbstractRegistrate<?> registrate, Variant<T> variant, WeatherState state, boolean waxed) {
String name = "";
if (waxed) {
name += "waxed_";
}
name += getWeatherStatePrefix(state);
name += this.name;
String suffix = variant.getSuffix();
if (!suffix.equals(""))
name = Lang.nonPluralId(name);
name += suffix;
Supplier<Block> baseBlock = BASE_BLOCKS.get(state);
BlockBuilder<T, ?> builder = registrate.block(name, variant.getFactory(this, state, waxed)).initialProperties(() -> baseBlock.get()).loot((lt, block) -> variant.generateLootTable(lt, block, this, state, waxed)).blockstate((ctx, prov) -> variant.generateBlockState(ctx, prov, this, state, waxed)).recipe((c, p) -> variant.generateRecipes(entries.get(BlockVariant.INSTANCE)[state.ordinal()], c, p)).transform(AllTags.pickaxeOnly()).tag(BlockTags.NEEDS_STONE_TOOL).simpleItem();
if (variant == BlockVariant.INSTANCE && state == WeatherState.UNAFFECTED)
builder.recipe((c, p) -> mainBlockRecipe.accept(c, p));
if (waxed) {
builder.recipe((ctx, prov) -> {
Block unwaxed = get(variant, state, false).get();
ShapelessRecipeBuilder.shapeless(ctx.get()).requires(unwaxed).requires(Items.HONEYCOMB).unlockedBy("has_unwaxed", RegistrateRecipeProvider.has(unwaxed)).save(prov, new ResourceLocation(ctx.getId().getNamespace(), "crafting/" + generalDirectory + ctx.getName() + "_from_honeycomb"));
});
}
return builder.register();
}
use of com.tterrag.registrate.builders.BlockBuilder in project Create by Creators-of-Create.
the class BuilderTransformers method bearing.
public static <B extends Block, P> NonNullUnaryOperator<BlockBuilder<B, P>> bearing(String prefix, String backTexture, boolean woodenTop) {
ResourceLocation baseBlockModelLocation = Create.asResource("block/bearing/block");
ResourceLocation baseItemModelLocation = Create.asResource("block/bearing/item");
ResourceLocation topTextureLocation = Create.asResource("block/bearing_top" + (woodenTop ? "_wooden" : ""));
ResourceLocation nookTextureLocation = Create.asResource("block/" + (woodenTop ? "andesite" : "brass") + "_casing");
ResourceLocation sideTextureLocation = Create.asResource("block/" + prefix + "_bearing_side");
ResourceLocation backTextureLocation = Create.asResource("block/" + backTexture);
return b -> b.initialProperties(SharedProperties::stone).properties(p -> p.noOcclusion()).blockstate((c, p) -> p.directionalBlock(c.get(), p.models().withExistingParent(c.getName(), baseBlockModelLocation).texture("side", sideTextureLocation).texture("nook", nookTextureLocation).texture("back", backTextureLocation))).item().model((c, p) -> p.withExistingParent(c.getName(), baseItemModelLocation).texture("top", topTextureLocation).texture("side", sideTextureLocation).texture("back", backTextureLocation)).build();
}
use of com.tterrag.registrate.builders.BlockBuilder 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