Search in sources :

Example 1 with ExtraTrees

use of binnie.extratrees.ExtraTrees in project Binnie by ForestryMC.

the class ModuleWood method onBakedEvent.

@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onBakedEvent(ModelBakeEvent e) {
    // Find all ExtraTrees saplings
    List<ModelResourceLocation> models = e.getModelRegistry().getKeys().stream().filter(mrl -> mrl.getResourceDomain().startsWith(Constants.EXTRA_TREES_MOD_ID)).filter(mrl -> mrl.getResourcePath().startsWith("germlings")).collect(Collectors.toList());
    // Replace model
    Map<String, ETTreeDefinition> map = Arrays.stream(ETTreeDefinition.values()).collect(Collectors.toMap(o -> o.name().toLowerCase(), o -> o));
    models.forEach(model -> {
        String species = model.getVariant().split("=")[1];
        ETTreeDefinition treeSpecies = map.get(species);
        int primaryColor = treeSpecies.getLeafColor().getRGB();
        int secondaryColor = treeSpecies.getWoodColor().getRGB();
        IBakedModel bakedModel = e.getModelRegistry().getObject(model);
        if (bakedModel == null) {
            return;
        }
        e.getModelRegistry().putObject(model, new DoublePassBakedModel(bakedModel, primaryColor, secondaryColor));
    });
}
Also used : IWoodType(forestry.api.arboriculture.IWoodType) ModelBakeEvent(net.minecraftforge.client.event.ModelBakeEvent) Arrays(java.util.Arrays) ForestryModule(forestry.api.modules.ForestryModule) IWoodTyped(forestry.arboriculture.IWoodTyped) ILiquidDefinition(binnie.core.liquid.ILiquidDefinition) EnumETLog(binnie.extratrees.wood.EnumETLog) EnumShrubLog(binnie.extratrees.wood.EnumShrubLog) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) PropertyETType(binnie.extratrees.blocks.property.PropertyETType) BlockETSlab(binnie.extratrees.blocks.wood.BlockETSlab) ExtraTrees(binnie.extratrees.ExtraTrees) Block(net.minecraft.block.Block) ModuleManager(binnie.core.modules.ModuleManager) OreDictionary(net.minecraftforge.oredict.OreDictionary) Side(net.minecraftforge.fml.relauncher.Side) WoodManager(binnie.extratrees.wood.WoodManager) Constants(binnie.core.Constants) FruitSprite(binnie.extratrees.genetics.fruits.FruitSprite) Map(java.util.Map) BlockETDoor(binnie.extratrees.blocks.wood.BlockETDoor) RecipeUtil(binnie.core.util.RecipeUtil) WoodBlockKind(forestry.api.arboriculture.WoodBlockKind) AlleleRegisterEvent(forestry.api.genetics.AlleleRegisterEvent) ITreeRoot(forestry.api.arboriculture.ITreeRoot) WoodAccess(forestry.arboriculture.WoodAccess) ItemMetadata(binnie.core.block.ItemMetadata) BlockForestryFenceGate(forestry.arboriculture.blocks.BlockForestryFenceGate) ModuleArboriculture(forestry.arboriculture.ModuleArboriculture) OreDictUtil(forestry.core.utils.OreDictUtil) BlockETDefaultLeaves(binnie.extratrees.blocks.BlockETDefaultLeaves) Collectors(java.util.stream.Collectors) ModuleUtils(binnie.core.util.ModuleUtils) BlockMultiFence(binnie.extratrees.blocks.decor.BlockMultiFence) DoublePassBakedModel(binnie.core.models.DoublePassBakedModel) List(java.util.List) BlockForestryStairs(forestry.arboriculture.blocks.BlockForestryStairs) BinnieCore(binnie.core.BinnieCore) BlockETDecorativeLeaves(binnie.extratrees.blocks.BlockETDecorativeLeaves) ItemETSlab(binnie.extratrees.blocks.wood.ItemETSlab) FMLInterModComms(net.minecraftforge.fml.common.event.FMLInterModComms) EnumVanillaWoodType(forestry.api.arboriculture.EnumVanillaWoodType) AlleleETFruitDefinition(binnie.extratrees.genetics.AlleleETFruitDefinition) FluidStack(net.minecraftforge.fluids.FluidStack) VanillaPlanks(binnie.extratrees.wood.planks.VanillaPlanks) BlockETFence(binnie.extratrees.blocks.wood.BlockETFence) ItemBlockETDecorativeLeaves(binnie.extratrees.items.ItemBlockETDecorativeLeaves) IButterflyRoot(forestry.api.lepidopterology.IButterflyRoot) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel) ExtraTreesModuleUIDs(binnie.core.modules.ExtraTreesModuleUIDs) ItemBlockETWood(binnie.extratrees.blocks.wood.ItemBlockETWood) RecipeManagers(forestry.api.recipes.RecipeManagers) IPlankType(binnie.extratrees.wood.planks.IPlankType) BlockETLog(binnie.extratrees.blocks.wood.BlockETLog) MultiFenceRecipeSize(binnie.extratrees.blocks.decor.MultiFenceRecipeSize) HashMap(java.util.HashMap) GameRegistry(net.minecraftforge.fml.common.registry.GameRegistry) MultiFenceRecipeEmbedded(binnie.extratrees.blocks.decor.MultiFenceRecipeEmbedded) ETTreeDefinition(binnie.extratrees.genetics.ETTreeDefinition) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack) ExtraTreePlanks(binnie.extratrees.wood.planks.ExtraTreePlanks) Minecraft(net.minecraft.client.Minecraft) TextureStitchEvent(net.minecraftforge.client.event.TextureStitchEvent) CarpentryManager(binnie.extratrees.api.CarpentryManager) ItemBlockETWoodDoor(binnie.extratrees.blocks.wood.ItemBlockETWoodDoor) ButterflySpecies(binnie.extratrees.genetics.ButterflySpecies) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) ForestryPlanks(binnie.extratrees.wood.planks.ForestryPlanks) Nullable(javax.annotation.Nullable) ItemBlockLeaves(forestry.arboriculture.items.ItemBlockLeaves) IAlleleFruit(forestry.api.arboriculture.IAlleleFruit) Items(net.minecraft.init.Items) ExtraTreeLiquid(binnie.extratrees.items.ExtraTreeLiquid) TextureMap(net.minecraft.client.renderer.texture.TextureMap) ForestryModuleUids(forestry.modules.ForestryModuleUids) MultiFenceRecipeSolid(binnie.extratrees.blocks.decor.MultiFenceRecipeSolid) BlockShrubLog(binnie.extratrees.blocks.wood.BlockShrubLog) TreeManager(forestry.api.arboriculture.TreeManager) Mods(binnie.core.Mods) AlleleSpeciesRegisterEvent(forestry.api.genetics.AlleleSpeciesRegisterEvent) IWoodAccess(forestry.api.arboriculture.IWoodAccess) ExtraTreeMutation(binnie.extratrees.genetics.ExtraTreeMutation) IBlockState(net.minecraft.block.state.IBlockState) MinecraftForge(net.minecraftforge.common.MinecraftForge) Fluids(forestry.core.fluids.Fluids) ForgeRegistries(net.minecraftforge.fml.common.registry.ForgeRegistries) ResourceLocation(net.minecraft.util.ResourceLocation) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) BlankModule(binnie.core.modules.BlankModule) Preconditions(com.google.common.base.Preconditions) BlockETPlank(binnie.extratrees.blocks.wood.BlockETPlank) ETTreeDefinition(binnie.extratrees.genetics.ETTreeDefinition) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel) DoublePassBakedModel(binnie.core.models.DoublePassBakedModel) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

BinnieCore (binnie.core.BinnieCore)1 Constants (binnie.core.Constants)1 Mods (binnie.core.Mods)1 ItemMetadata (binnie.core.block.ItemMetadata)1 ILiquidDefinition (binnie.core.liquid.ILiquidDefinition)1 DoublePassBakedModel (binnie.core.models.DoublePassBakedModel)1 BlankModule (binnie.core.modules.BlankModule)1 ExtraTreesModuleUIDs (binnie.core.modules.ExtraTreesModuleUIDs)1 ModuleManager (binnie.core.modules.ModuleManager)1 ModuleUtils (binnie.core.util.ModuleUtils)1 RecipeUtil (binnie.core.util.RecipeUtil)1 ExtraTrees (binnie.extratrees.ExtraTrees)1 CarpentryManager (binnie.extratrees.api.CarpentryManager)1 BlockETDecorativeLeaves (binnie.extratrees.blocks.BlockETDecorativeLeaves)1 BlockETDefaultLeaves (binnie.extratrees.blocks.BlockETDefaultLeaves)1 BlockMultiFence (binnie.extratrees.blocks.decor.BlockMultiFence)1 MultiFenceRecipeEmbedded (binnie.extratrees.blocks.decor.MultiFenceRecipeEmbedded)1 MultiFenceRecipeSize (binnie.extratrees.blocks.decor.MultiFenceRecipeSize)1 MultiFenceRecipeSolid (binnie.extratrees.blocks.decor.MultiFenceRecipeSolid)1 PropertyETType (binnie.extratrees.blocks.property.PropertyETType)1