Search in sources :

Example 1 with IFlowerType

use of binnie.botany.api.genetics.IFlowerType in project Binnie by ForestryMC.

the class StateMapperFlower method getModelResourceLocation.

@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
    Map<IProperty<?>, Comparable<?>> properties = Maps.newLinkedHashMap(state.getProperties());
    IFlowerType flowerType = (IFlowerType) state.getValue(BlockFlower.FLOWER);
    if (flowerType.getSections() < 2) {
        properties.remove(BlockFlower.SECTION);
    } else if (flowerType.getSections() <= state.getValue(BlockFlower.SECTION)) {
        properties.put(BlockFlower.SECTION, flowerType.getSections() - 1);
    }
    if (state.getValue(BlockFlower.SEED)) {
        properties.remove(BlockFlower.SECTION);
        properties.remove(BlockFlower.FLOWER);
        properties.remove(BlockFlower.FLOWERED);
    } else {
        properties.remove(BlockFlower.SEED);
    }
    return new ModelResourceLocation(Constants.BOTANY_MOD_ID + ":flower", getPropertyString(properties));
}
Also used : IFlowerType(binnie.botany.api.genetics.IFlowerType) IProperty(net.minecraft.block.properties.IProperty) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Aggregations

IFlowerType (binnie.botany.api.genetics.IFlowerType)1 IProperty (net.minecraft.block.properties.IProperty)1 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)1