Search in sources :

Example 1 with BlockModelBuilder

use of net.minecraftforge.client.model.generators.BlockModelBuilder in project Tropicraft by Tropicraft.

the class TropicraftBlockstateProvider method hugePlant.

private void hugePlant(Supplier<? extends HugePlantBlock> block, ResourceLocation texture, ResourceLocation particle) {
    BlockModelBuilder cross = models().withExistingParent(name(block), modBlockLoc("huge_cross")).texture("cross", texture).texture("particle", particle);
    getMultipartBuilder(block.get()).part().modelFile(cross).addModel().condition(HugePlantBlock.TYPE, HugePlantBlock.Type.CENTER);
}
Also used : BlockModelBuilder(net.minecraftforge.client.model.generators.BlockModelBuilder)

Example 2 with BlockModelBuilder

use of net.minecraftforge.client.model.generators.BlockModelBuilder in project Tropicraft by Tropicraft.

the class TropicraftBlockstateProvider method propagule.

private void propagule(Supplier<? extends PropaguleBlock> block) {
    String name = name(block);
    BlockModelBuilder planted = models().cross(name + "_planted", modBlockLoc(name + "_planted"));
    BlockModelBuilder hanging = models().cross(name + "_hanging", modBlockLoc(name));
    getVariantBuilder(block.get()).partialState().with(PropaguleBlock.PLANTED, false).addModels(new ConfiguredModel(hanging)).partialState().with(PropaguleBlock.PLANTED, true).addModels(new ConfiguredModel(planted));
}
Also used : ConfiguredModel(net.minecraftforge.client.model.generators.ConfiguredModel) BlockModelBuilder(net.minecraftforge.client.model.generators.BlockModelBuilder)

Example 3 with BlockModelBuilder

use of net.minecraftforge.client.model.generators.BlockModelBuilder in project Tropicraft by Tropicraft.

the class TropicraftBlockstateProvider method flowerPot.

private void flowerPot(Supplier<? extends FlowerPotBlock> full, Supplier<? extends Block> empty, ResourceLocation particle) {
    Block flower = full.get().getContent();
    boolean isVanilla = flower.getRegistryName().getNamespace().equals("minecraft");
    String parent = flower == Blocks.AIR ? "flower_pot" : !isVanilla ? "flower_pot_cross" : ModelProvider.BLOCK_FOLDER + "/potted_" + name(flower.delegate);
    BlockModelBuilder model = models().withExistingParent(name(full), parent).texture("flowerpot", blockTexture(empty)).texture("dirt", mcLoc("block/dirt")).texture("particle", modBlockLoc("bamboo_side"));
    if (!isVanilla) {
        if (flower instanceof TropicsFlowerBlock) {
            model.texture("plant", modLoc(ModelProvider.BLOCK_FOLDER + "/flower/" + name(flower.delegate)));
        } else if (flower instanceof TallFlowerBlock) {
            model.texture("plant", modLoc(ModelProvider.BLOCK_FOLDER + "/" + name(flower.delegate) + "_top"));
        } else {
            model.texture("plant", blockTexture(flower));
        }
    }
    simpleBlock(full, model);
}
Also used : TallFlowerBlock(net.minecraft.world.level.block.TallFlowerBlock) TropicsFlowerBlock(net.tropicraft.core.common.block.TropicsFlowerBlock) FenceGateBlock(net.minecraft.world.level.block.FenceGateBlock) TrapDoorBlock(net.minecraft.world.level.block.TrapDoorBlock) RedstoneTorchBlock(net.minecraft.world.level.block.RedstoneTorchBlock) LadderBlock(net.minecraft.world.level.block.LadderBlock) WallBlock(net.minecraft.world.level.block.WallBlock) TropicsFlowerBlock(net.tropicraft.core.common.block.TropicsFlowerBlock) BushBlock(net.minecraft.world.level.block.BushBlock) HugePlantBlock(net.tropicraft.core.common.block.huge_plant.HugePlantBlock) DoublePlantBlock(net.minecraft.world.level.block.DoublePlantBlock) StairBlock(net.minecraft.world.level.block.StairBlock) TikiTorchBlock(net.tropicraft.core.common.block.TikiTorchBlock) FlowerPotBlock(net.minecraft.world.level.block.FlowerPotBlock) BongoDrumBlock(net.tropicraft.core.common.block.BongoDrumBlock) SlabBlock(net.minecraft.world.level.block.SlabBlock) FenceBlock(net.minecraft.world.level.block.FenceBlock) RedstoneWallTorchBlock(net.minecraft.world.level.block.RedstoneWallTorchBlock) TallFlowerBlock(net.minecraft.world.level.block.TallFlowerBlock) CoffeeBushBlock(net.tropicraft.core.common.block.CoffeeBushBlock) ReedsBlock(net.tropicraft.core.common.block.ReedsBlock) MangroveRootsBlock(net.tropicraft.core.common.block.MangroveRootsBlock) DoorBlock(net.minecraft.world.level.block.DoorBlock) BoardwalkBlock(net.tropicraft.core.common.block.BoardwalkBlock) PropaguleBlock(net.tropicraft.core.common.block.PropaguleBlock) Block(net.minecraft.world.level.block.Block) RotatedPillarBlock(net.minecraft.world.level.block.RotatedPillarBlock) BlockModelBuilder(net.minecraftforge.client.model.generators.BlockModelBuilder)

Example 4 with BlockModelBuilder

use of net.minecraftforge.client.model.generators.BlockModelBuilder in project Tropicraft by Tropicraft.

the class TropicraftBlockstateProvider method jigarbovTorch.

private void jigarbovTorch(Supplier<? extends RedstoneTorchBlock> block, JigarbovTorchType type) {
    ResourceLocation parent = modBlockLoc("jigarbov_wall_torch");
    ResourceLocation etchTexture = modBlockLoc("jigarbov/" + type.getName());
    BlockModelBuilder modelLit = models().withExistingParent(name(block), parent).texture("torch", mcLoc("block/redstone_torch")).texture("jigarbov", etchTexture);
    BlockModelBuilder modelOff = models().withExistingParent(name(block) + "_off", parent).texture("torch", mcLoc("block/redstone_torch_off")).texture("jigarbov", etchTexture);
    getVariantBuilder(block.get()).forAllStates(state -> {
        boolean lit = state.getValue(RedstoneTorchBlock.LIT);
        Direction facing = state.getValue(RedstoneWallTorchBlock.FACING);
        int angle = ((int) facing.toYRot() + 90) % 360;
        return ConfiguredModel.builder().modelFile(lit ? modelLit : modelOff).rotationY(angle).build();
    });
}
Also used : ResourceLocation(net.minecraft.resources.ResourceLocation) BlockModelBuilder(net.minecraftforge.client.model.generators.BlockModelBuilder) Direction(net.minecraft.core.Direction)

Aggregations

BlockModelBuilder (net.minecraftforge.client.model.generators.BlockModelBuilder)4 Direction (net.minecraft.core.Direction)1 ResourceLocation (net.minecraft.resources.ResourceLocation)1 Block (net.minecraft.world.level.block.Block)1 BushBlock (net.minecraft.world.level.block.BushBlock)1 DoorBlock (net.minecraft.world.level.block.DoorBlock)1 DoublePlantBlock (net.minecraft.world.level.block.DoublePlantBlock)1 FenceBlock (net.minecraft.world.level.block.FenceBlock)1 FenceGateBlock (net.minecraft.world.level.block.FenceGateBlock)1 FlowerPotBlock (net.minecraft.world.level.block.FlowerPotBlock)1 LadderBlock (net.minecraft.world.level.block.LadderBlock)1 RedstoneTorchBlock (net.minecraft.world.level.block.RedstoneTorchBlock)1 RedstoneWallTorchBlock (net.minecraft.world.level.block.RedstoneWallTorchBlock)1 RotatedPillarBlock (net.minecraft.world.level.block.RotatedPillarBlock)1 SlabBlock (net.minecraft.world.level.block.SlabBlock)1 StairBlock (net.minecraft.world.level.block.StairBlock)1 TallFlowerBlock (net.minecraft.world.level.block.TallFlowerBlock)1 TrapDoorBlock (net.minecraft.world.level.block.TrapDoorBlock)1 WallBlock (net.minecraft.world.level.block.WallBlock)1 ConfiguredModel (net.minecraftforge.client.model.generators.ConfiguredModel)1