Search in sources :

Example 11 with IWoodType

use of forestry.api.arboriculture.IWoodType in project ForestryMC by ForestryMC.

the class ModuleArboriculture method registerSprites.

@SubscribeEvent
@SideOnly(Side.CLIENT)
public void registerSprites(TextureStitchEvent.Pre event) {
    TextureLeaves.registerAllSprites();
    WoodTextureManager.parseFile();
    for (IAlleleFruit alleleFruit : AlleleFruits.getFruitAlleles()) {
        alleleFruit.getProvider().registerSprites();
    }
    List<ResourceLocation> textures = new ArrayList<>();
    for (IWoodType type : TreeManager.woodAccess.getRegisteredWoodTypes()) {
        textures.add(new ResourceLocation(type.getHeartTexture()));
        textures.add(new ResourceLocation(type.getBarkTexture()));
        textures.add(new ResourceLocation(type.getDoorLowerTexture()));
        textures.add(new ResourceLocation(type.getDoorUpperTexture()));
        textures.add(new ResourceLocation(type.getPlankTexture()));
        for (WoodBlockKind kind : WoodBlockKind.values()) {
            for (Entry<String, String> loc : WoodTextureManager.getTextures(type, kind).entrySet()) {
                textures.add(new ResourceLocation(loc.getValue()));
            }
        }
    }
    for (ResourceLocation loc : textures) {
        TextureManagerForestry.registerSprite(loc);
    }
}
Also used : IWoodType(forestry.api.arboriculture.IWoodType) WoodBlockKind(forestry.api.arboriculture.WoodBlockKind) ResourceLocation(net.minecraft.util.ResourceLocation) ArrayList(java.util.ArrayList) IAlleleFruit(forestry.api.arboriculture.IAlleleFruit) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 12 with IWoodType

use of forestry.api.arboriculture.IWoodType in project ForestryMC by ForestryMC.

the class ModuleArboriculture method registerRecipes.

@Override
public void registerRecipes() {
    ItemRegistryCore coreItems = ModuleCore.getItems();
    BlockRegistryArboriculture blocks = getBlocks();
    ItemRegistryArboriculture items = getItems();
    for (BlockArbLog log : blocks.logs) {
        ItemStack logInput = new ItemStack(log, 1, OreDictionary.WILDCARD_VALUE);
        ItemStack coalOutput = new ItemStack(Items.COAL, 1, 1);
        RecipeUtil.addSmelting(logInput, coalOutput, 0.15F);
    }
    List<IWoodType> allWoodTypes = new ArrayList<>();
    Collections.addAll(allWoodTypes, EnumForestryWoodType.VALUES);
    Collections.addAll(allWoodTypes, EnumVanillaWoodType.VALUES);
    for (IWoodType woodType : allWoodTypes) {
        ItemStack planks = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.PLANKS, false);
        ItemStack logs = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.LOG, false);
        ItemStack slabs = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.SLAB, false);
        ItemStack fences = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.FENCE, false);
        ItemStack fenceGates = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.FENCE_GATE, false);
        ItemStack stairs = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.STAIRS, false);
        ItemStack doors = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.DOOR, false);
        ItemStack fireproofPlanks = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.PLANKS, true);
        ItemStack fireproofLogs = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.LOG, true);
        ItemStack fireproofSlabs = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.SLAB, true);
        ItemStack fireproofFences = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.FENCE, true);
        ItemStack fireproofFenceGates = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.FENCE_GATE, true);
        ItemStack fireproofStairs = TreeManager.woodAccess.getStack(woodType, WoodBlockKind.STAIRS, true);
        if (woodType instanceof EnumForestryWoodType) {
            planks.setCount(4);
            logs.setCount(1);
            RecipeUtil.addShapelessRecipe("planks_" + woodType.getName(), planks.copy(), logs.copy());
            slabs.setCount(6);
            planks.setCount(1);
            RecipeUtil.addRecipe("slabs_" + woodType.getName(), slabs.copy(), "###", '#', planks.copy());
            fences.setCount(3);
            planks.setCount(1);
            RecipeUtil.addRecipe("fences_" + woodType.getName(), fences.copy(), "#X#", "#X#", '#', planks.copy(), 'X', "stickWood");
            fenceGates.setCount(1);
            planks.setCount(1);
            RecipeUtil.addRecipe("fence_gates_" + woodType.getName(), fenceGates.copy(), "X#X", "X#X", '#', planks.copy(), 'X', "stickWood");
            stairs.setCount(4);
            planks.setCount(1);
            RecipeUtil.addRecipe("stairs_" + woodType.getName(), stairs.copy(), "#  ", "## ", "###", '#', planks.copy());
            doors.setCount(3);
            planks.setCount(1);
            RecipeUtil.addRecipe("doors_" + woodType.getName(), doors.copy(), "## ", "## ", "## ", '#', planks.copy());
        }
        fireproofPlanks.setCount(4);
        fireproofLogs.setCount(1);
        RecipeUtil.addShapelessRecipe("fireproof_planks_" + woodType.getName(), fireproofPlanks.copy(), fireproofLogs.copy());
        fireproofSlabs.setCount(6);
        fireproofPlanks.setCount(1);
        RecipeUtil.addRecipe("fireproof_slabs_" + woodType.getName(), fireproofSlabs.copy(), "###", '#', fireproofPlanks.copy());
        fireproofFences.setCount(3);
        fireproofPlanks.setCount(1);
        RecipeUtil.addRecipe("fireproof_fences_" + woodType.getName(), fireproofFences.copy(), "#X#", "#X#", '#', fireproofPlanks.copy(), 'X', "stickWood");
        fireproofFenceGates.setCount(1);
        fireproofPlanks.setCount(1);
        RecipeUtil.addRecipe("fireproof_fence_gates_" + woodType.getName(), fireproofFenceGates.copy(), "X#X", "X#X", '#', fireproofPlanks.copy(), 'X', "stickWood");
        fireproofStairs.setCount(4);
        fireproofPlanks.setCount(1);
        RecipeUtil.addRecipe("fireproof_stairs_" + woodType.getName(), fireproofStairs.copy(), "#  ", "## ", "###", '#', fireproofPlanks.copy());
        doors.setCount(3);
        fireproofPlanks.setCount(1);
        RecipeUtil.addRecipe("fireproof_doors_" + woodType.getName(), doors.copy(), "## ", "## ", "## ", '#', fireproofPlanks.copy());
        // Fabricator recipes
        if (ForestryAPI.enabledModules.containsAll(Arrays.asList(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FACTORY), new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.APICULTURE)))) {
            logs.setCount(1);
            fireproofLogs.setCount(1);
            RecipeManagers.fabricatorManager.addRecipe(ItemStack.EMPTY, Fluids.GLASS.getFluid(500), fireproofLogs.copy(), new Object[] { " # ", "#X#", " # ", '#', coreItems.refractoryWax, 'X', logs.copy() });
            planks.setCount(1);
            fireproofPlanks.setCount(5);
            RecipeManagers.fabricatorManager.addRecipe(ItemStack.EMPTY, Fluids.GLASS.getFluid(500), fireproofPlanks.copy(), new Object[] { "X#X", "#X#", "X#X", '#', coreItems.refractoryWax, 'X', planks.copy() });
        }
    }
    if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FACTORY))) {
        // SQUEEZER RECIPES
        int seedOilMultiplier = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
        int juiceMultiplier = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.apple");
        int mulchMultiplier = ForestryAPI.activeMode.getIntegerSetting("squeezer.mulch.apple");
        ItemStack mulch = new ItemStack(coreItems.mulch);
        RecipeManagers.squeezerManager.addRecipe(20, EnumFruit.CHERRY.getStack(), Fluids.SEED_OIL.getFluid(5 * seedOilMultiplier), mulch, 5);
        RecipeManagers.squeezerManager.addRecipe(60, EnumFruit.WALNUT.getStack(), Fluids.SEED_OIL.getFluid(18 * seedOilMultiplier), mulch, 5);
        RecipeManagers.squeezerManager.addRecipe(70, EnumFruit.CHESTNUT.getStack(), Fluids.SEED_OIL.getFluid(22 * seedOilMultiplier), mulch, 2);
        RecipeManagers.squeezerManager.addRecipe(10, EnumFruit.LEMON.getStack(), Fluids.JUICE.getFluid(juiceMultiplier * 2), mulch, (int) Math.floor(mulchMultiplier * 0.5f));
        RecipeManagers.squeezerManager.addRecipe(10, EnumFruit.PLUM.getStack(), Fluids.JUICE.getFluid((int) Math.floor(juiceMultiplier * 0.5f)), mulch, mulchMultiplier * 3);
        RecipeManagers.squeezerManager.addRecipe(10, EnumFruit.PAPAYA.getStack(), Fluids.JUICE.getFluid(juiceMultiplier * 3), mulch, (int) Math.floor(mulchMultiplier * 0.5f));
        RecipeManagers.squeezerManager.addRecipe(10, EnumFruit.DATES.getStack(), Fluids.JUICE.getFluid((int) Math.floor(juiceMultiplier * 0.25)), mulch, mulchMultiplier);
        RecipeUtil.addFermenterRecipes(new ItemStack(items.sapling, 1, OreDictionary.WILDCARD_VALUE), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.sapling"), Fluids.BIOMASS);
    }
    // Grafter
    RecipeUtil.addRecipe("grafter", items.grafter.getItemStack(), "  B", " # ", "#  ", 'B', "ingotBronze", '#', "stickWood");
    RecipeUtil.addRecipe("tree_chest", blocks.treeChest, " # ", "XYX", "XXX", '#', "blockGlass", 'X', "treeSapling", 'Y', "chestWood");
}
Also used : IWoodType(forestry.api.arboriculture.IWoodType) ItemRegistryArboriculture(forestry.arboriculture.items.ItemRegistryArboriculture) ItemRegistryCore(forestry.core.items.ItemRegistryCore) ResourceLocation(net.minecraft.util.ResourceLocation) ArrayList(java.util.ArrayList) BlockRegistryArboriculture(forestry.arboriculture.blocks.BlockRegistryArboriculture) EnumForestryWoodType(forestry.api.arboriculture.EnumForestryWoodType) BlockArbLog(forestry.arboriculture.blocks.BlockArbLog) ItemStack(net.minecraft.item.ItemStack)

Example 13 with IWoodType

use of forestry.api.arboriculture.IWoodType in project Binnie by ForestryMC.

the class ItemETSlab method getUnlocalizedName.

@Override
public String getUnlocalizedName(ItemStack stack) {
    BlockETSlab wood = (BlockETSlab) getBlock();
    int meta = stack.getMetadata();
    IWoodType woodType = wood.getWoodType(meta);
    return WoodManager.getDisplayName(wood, woodType);
}
Also used : IWoodType(forestry.api.arboriculture.IWoodType)

Example 14 with IWoodType

use of forestry.api.arboriculture.IWoodType in project Binnie by ForestryMC.

the class ItemETSlab method getItemStackDisplayName.

@Override
public String getItemStackDisplayName(ItemStack itemstack) {
    BlockETSlab wood = (BlockETSlab) getBlock();
    int meta = itemstack.getMetadata();
    IWoodType woodType = wood.getWoodType(meta);
    return WoodManager.getDisplayName(wood, woodType);
}
Also used : IWoodType(forestry.api.arboriculture.IWoodType)

Aggregations

IWoodType (forestry.api.arboriculture.IWoodType)14 EnumVanillaWoodType (forestry.api.arboriculture.EnumVanillaWoodType)6 ItemStack (net.minecraft.item.ItemStack)5 IBlockState (net.minecraft.block.state.IBlockState)4 WoodBlockKind (forestry.api.arboriculture.WoodBlockKind)3 ArrayList (java.util.ArrayList)3 ResourceLocation (net.minecraft.util.ResourceLocation)3 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)3 IWoodTyped (forestry.arboriculture.IWoodTyped)2 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)2 BarrelSkin (com.latmod.yabba.api.BarrelSkin)1 EnumForestryWoodType (forestry.api.arboriculture.EnumForestryWoodType)1 IAlleleFruit (forestry.api.arboriculture.IAlleleFruit)1 IWoodItemMeshDefinition (forestry.api.arboriculture.IWoodItemMeshDefinition)1 IWoodStateMapper (forestry.api.arboriculture.IWoodStateMapper)1 BlockArbLog (forestry.arboriculture.blocks.BlockArbLog)1 BlockForestrySlab (forestry.arboriculture.blocks.BlockForestrySlab)1 BlockRegistryArboriculture (forestry.arboriculture.blocks.BlockRegistryArboriculture)1 ItemRegistryArboriculture (forestry.arboriculture.items.ItemRegistryArboriculture)1 ItemRegistryCore (forestry.core.items.ItemRegistryCore)1