Search in sources :

Example 1 with BlockDecorativeLeaves

use of forestry.arboriculture.blocks.BlockDecorativeLeaves in project ForestryMC by ForestryMC.

the class ItemBlockDecorativeLeaves method getColorFromItemstack.

@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemstack(ItemStack itemStack, int renderPass) {
    int meta = itemStack.getMetadata();
    BlockDecorativeLeaves block = getBlock();
    TreeDefinition treeDefinition = block.getTreeType(meta);
    ITreeGenome genome = treeDefinition.getGenome();
    if (renderPass == BlockAbstractLeaves.FRUIT_COLOR_INDEX) {
        IFruitProvider fruitProvider = genome.getFruitProvider();
        return fruitProvider.getDecorativeColor();
    }
    return genome.getPrimary().getLeafSpriteProvider().getColor(false);
}
Also used : BlockDecorativeLeaves(forestry.arboriculture.blocks.BlockDecorativeLeaves) TreeDefinition(forestry.arboriculture.genetics.TreeDefinition) ITreeGenome(forestry.api.arboriculture.ITreeGenome) IFruitProvider(forestry.api.arboriculture.IFruitProvider) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with BlockDecorativeLeaves

use of forestry.arboriculture.blocks.BlockDecorativeLeaves in project ForestryMC by ForestryMC.

the class ItemBlockDecorativeLeaves method getItemStackDisplayName.

@Override
public String getItemStackDisplayName(ItemStack itemStack) {
    int meta = itemStack.getMetadata();
    BlockDecorativeLeaves block = getBlock();
    TreeDefinition treeDefinition = block.getTreeType(meta);
    String unlocalizedSpeciesName = treeDefinition.getUnlocalizedName();
    return ItemBlockLeaves.getDisplayName(unlocalizedSpeciesName);
}
Also used : BlockDecorativeLeaves(forestry.arboriculture.blocks.BlockDecorativeLeaves) TreeDefinition(forestry.arboriculture.genetics.TreeDefinition)

Example 3 with BlockDecorativeLeaves

use of forestry.arboriculture.blocks.BlockDecorativeLeaves in project ForestryMC by ForestryMC.

the class ModelDecorativeLeaves method getWorldKey.

@Override
protected TreeDefinition getWorldKey(IBlockState state) {
    Block block = state.getBlock();
    Preconditions.checkArgument(block instanceof BlockDecorativeLeaves, "state must be for decorative leaves.");
    BlockDecorativeLeaves bBlock = (BlockDecorativeLeaves) block;
    return state.getValue(bBlock.getVariant());
}
Also used : BlockDecorativeLeaves(forestry.arboriculture.blocks.BlockDecorativeLeaves) Block(net.minecraft.block.Block)

Example 4 with BlockDecorativeLeaves

use of forestry.arboriculture.blocks.BlockDecorativeLeaves in project ForestryMC by ForestryMC.

the class ModelDecorativeLeaves method getInventoryKey.

@Override
protected TreeDefinition getInventoryKey(ItemStack stack) {
    Block block = Block.getBlockFromItem(stack.getItem());
    Preconditions.checkArgument(block instanceof BlockDecorativeLeaves, "ItemStack must be for decorative leaves.");
    BlockDecorativeLeaves bBlock = (BlockDecorativeLeaves) block;
    return bBlock.getTreeType(stack.getMetadata());
}
Also used : BlockDecorativeLeaves(forestry.arboriculture.blocks.BlockDecorativeLeaves) Block(net.minecraft.block.Block)

Example 5 with BlockDecorativeLeaves

use of forestry.arboriculture.blocks.BlockDecorativeLeaves in project ForestryMC by ForestryMC.

the class ProxyArboricultureClient method initializeModels.

@Override
public void initializeModels() {
    {
        ModelResourceLocation blockModelLocation = new ModelResourceLocation("forestry:leaves");
        ModelResourceLocation itemModelLocation = new ModelResourceLocation("forestry:leaves", "inventory");
        BlockModelEntry blockModelIndex = new BlockModelEntry(blockModelLocation, itemModelLocation, new ModelLeaves(), ModuleArboriculture.getBlocks().leaves);
        ModelManager.getInstance().registerCustomBlockModel(blockModelIndex);
    }
    for (BlockDecorativeLeaves leaves : ModuleArboriculture.getBlocks().leavesDecorative) {
        String resourceName = "forestry:leaves.decorative." + leaves.getBlockNumber();
        ModelResourceLocation blockModelLocation = new ModelResourceLocation(resourceName);
        ModelResourceLocation itemModeLocation = new ModelResourceLocation(resourceName, "inventory");
        BlockModelEntry blockModelIndex = new BlockModelEntry(blockModelLocation, itemModeLocation, new ModelDecorativeLeaves(), leaves);
        ModelManager.getInstance().registerCustomBlockModel(blockModelIndex);
    }
    for (BlockDefaultLeaves leaves : ModuleArboriculture.getBlocks().leavesDefault) {
        String resourceName = "forestry:leaves.default." + leaves.getBlockNumber();
        ModelResourceLocation blockModelLocation = new ModelResourceLocation(resourceName);
        ModelResourceLocation itemModeLocation = new ModelResourceLocation(resourceName, "inventory");
        BlockModelEntry blockModelIndex = new BlockModelEntry(blockModelLocation, itemModeLocation, new ModelDefaultLeaves(), leaves);
        ModelManager.getInstance().registerCustomBlockModel(blockModelIndex);
    }
    ModelLoaderRegistry.registerLoader(WoodModelLoader.INSTANCE);
    for (BlockArbSlab slab : ModuleArboriculture.getBlocks().slabsDouble) {
        registerWoodModel(slab, true);
    }
    for (BlockArbSlab slab : ModuleArboriculture.getBlocks().slabsDoubleFireproof) {
        registerWoodModel(slab, true);
    }
}
Also used : BlockArbSlab(forestry.arboriculture.blocks.BlockArbSlab) BlockModelEntry(forestry.core.models.BlockModelEntry) ModelDefaultLeaves(forestry.arboriculture.models.ModelDefaultLeaves) ModelLeaves(forestry.arboriculture.models.ModelLeaves) BlockDecorativeLeaves(forestry.arboriculture.blocks.BlockDecorativeLeaves) ModelDecorativeLeaves(forestry.arboriculture.models.ModelDecorativeLeaves) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) BlockDefaultLeaves(forestry.arboriculture.blocks.BlockDefaultLeaves)

Aggregations

BlockDecorativeLeaves (forestry.arboriculture.blocks.BlockDecorativeLeaves)5 TreeDefinition (forestry.arboriculture.genetics.TreeDefinition)2 Block (net.minecraft.block.Block)2 IFruitProvider (forestry.api.arboriculture.IFruitProvider)1 ITreeGenome (forestry.api.arboriculture.ITreeGenome)1 BlockArbSlab (forestry.arboriculture.blocks.BlockArbSlab)1 BlockDefaultLeaves (forestry.arboriculture.blocks.BlockDefaultLeaves)1 ModelDecorativeLeaves (forestry.arboriculture.models.ModelDecorativeLeaves)1 ModelDefaultLeaves (forestry.arboriculture.models.ModelDefaultLeaves)1 ModelLeaves (forestry.arboriculture.models.ModelLeaves)1 BlockModelEntry (forestry.core.models.BlockModelEntry)1 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1