Search in sources :

Example 1 with TotemBaseBlock

use of pokefenn.totemic.block.totem.TotemBaseBlock in project Totemic by TeamTotemic.

the class ModBlocks method init.

@SubscribeEvent
public static void init(RegistryEvent.Register<Block> event) {
    internallyRegisterTotemEffects();
    for (TotemWoodType woodType : TotemWoodType.getWoodTypes()) {
        Properties blockProperties = Properties.of(Material.WOOD, woodType.getWoodColor()).strength(2, 5).sound(SoundType.WOOD);
        TotemBaseBlock totemBase = new TotemBaseBlock(woodType, blockProperties);
        totemBase.setRegistryName(Totemic.MOD_ID, woodType.getName() + "_totem_base");
        event.getRegistry().register(totemBase);
        totemBases.put(woodType, totemBase);
        blocksWithItemBlock.add(totemBase);
        for (TotemEffect totemEffect : totemEffectsToRegister) {
            TotemPoleBlock totemPole = new TotemPoleBlock(woodType, totemEffect, blockProperties);
            totemPole.setRegistryName(Totemic.MOD_ID, woodType.getName() + "_totem_pole_" + totemEffect.getRegistryName().getPath());
            event.getRegistry().register(totemPole);
            totemPoles.put(woodType, totemEffect, totemPole);
            blocksWithItemBlock.add(totemPole);
        }
    }
}
Also used : TotemWoodType(pokefenn.totemic.api.TotemWoodType) Properties(net.minecraft.world.level.block.state.BlockBehaviour.Properties) TotemEffect(pokefenn.totemic.api.totem.TotemEffect) TotemBaseBlock(pokefenn.totemic.block.totem.TotemBaseBlock) TotemPoleBlock(pokefenn.totemic.block.totem.TotemPoleBlock) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Example 2 with TotemBaseBlock

use of pokefenn.totemic.block.totem.TotemBaseBlock in project Totemic by TeamTotemic.

the class TotemicBlockStateProvider method registerStatesAndModels.

@Override
protected void registerStatesAndModels() {
    for (TotemBaseBlock block : ModBlocks.getTotemBases().values()) {
        ResourceLocation blockName = block.getRegistryName();
        ModelFile blockModel = models().getExistingFile(new ResourceLocation(blockName.getNamespace(), ModelProvider.BLOCK_FOLDER + "/" + blockName.getPath()));
        // Block state
        horizontalBlock(block, blockModel);
        // Item model
        itemModels().withExistingParent(block.getRegistryName().toString(), blockModel.getLocation());
    }
}
Also used : ModelFile(net.minecraftforge.client.model.generators.ModelFile) ResourceLocation(net.minecraft.resources.ResourceLocation) TotemBaseBlock(pokefenn.totemic.block.totem.TotemBaseBlock)

Aggregations

TotemBaseBlock (pokefenn.totemic.block.totem.TotemBaseBlock)2 ResourceLocation (net.minecraft.resources.ResourceLocation)1 Properties (net.minecraft.world.level.block.state.BlockBehaviour.Properties)1 ModelFile (net.minecraftforge.client.model.generators.ModelFile)1 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)1 TotemWoodType (pokefenn.totemic.api.TotemWoodType)1 TotemEffect (pokefenn.totemic.api.totem.TotemEffect)1 TotemPoleBlock (pokefenn.totemic.block.totem.TotemPoleBlock)1