Search in sources :

Example 1 with ItemRegistryArboriculture

use of forestry.arboriculture.items.ItemRegistryArboriculture in project ForestryMC by ForestryMC.

the class TreeRoot method getType.

/* TREE SPECIFIC */
@Override
@Nullable
public EnumGermlingType getType(ItemStack stack) {
    if (stack.isEmpty()) {
        return null;
    }
    ItemRegistryArboriculture items = ModuleArboriculture.getItems();
    Item item = stack.getItem();
    if (items.sapling == item) {
        return EnumGermlingType.SAPLING;
    } else if (items.pollenFertile == item) {
        return EnumGermlingType.POLLEN;
    }
    return null;
}
Also used : Item(net.minecraft.item.Item) ItemRegistryArboriculture(forestry.arboriculture.items.ItemRegistryArboriculture) Nullable(javax.annotation.Nullable)

Example 2 with ItemRegistryArboriculture

use of forestry.arboriculture.items.ItemRegistryArboriculture in project ForestryMC by ForestryMC.

the class ModuleArboriculture method registerItemsAndBlocks.

@Override
public void registerItemsAndBlocks() {
    items = new ItemRegistryArboriculture();
    blocks = new BlockRegistryArboriculture();
}
Also used : ItemRegistryArboriculture(forestry.arboriculture.items.ItemRegistryArboriculture) BlockRegistryArboriculture(forestry.arboriculture.blocks.BlockRegistryArboriculture)

Example 3 with ItemRegistryArboriculture

use of forestry.arboriculture.items.ItemRegistryArboriculture in project ForestryMC by ForestryMC.

the class TreeRoot method getMemberStack.

@Override
public ItemStack getMemberStack(IIndividual tree, ISpeciesType type) {
    Preconditions.checkArgument(tree instanceof ITree, "individual is not a tree");
    Preconditions.checkArgument(type instanceof EnumGermlingType, "type is not an EnumGermlingType");
    ItemRegistryArboriculture items = ModuleArboriculture.getItems();
    Item germlingItem;
    switch((EnumGermlingType) type) {
        case SAPLING:
            germlingItem = items.sapling;
            break;
        case POLLEN:
            germlingItem = items.pollenFertile;
            break;
        default:
            throw new RuntimeException("Cannot instantiate a tree of type " + type);
    }
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    tree.writeToNBT(nbttagcompound);
    ItemStack treeStack = new ItemStack(germlingItem);
    treeStack.setTagCompound(nbttagcompound);
    return treeStack;
}
Also used : Item(net.minecraft.item.Item) ItemRegistryArboriculture(forestry.arboriculture.items.ItemRegistryArboriculture) EnumGermlingType(forestry.api.arboriculture.EnumGermlingType) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ITree(forestry.api.arboriculture.ITree) ItemStack(net.minecraft.item.ItemStack)

Example 4 with ItemRegistryArboriculture

use of forestry.arboriculture.items.ItemRegistryArboriculture in project ForestryMC by ForestryMC.

the class ModuleArboriculture method doInit.

@Override
public void doInit() {
    // Create alleles
    registerAlleles();
    TreeDefinition.initTrees();
    registerErsatzGenomes();
    GameRegistry.registerTileEntity(TileSapling.class, "forestry.Sapling");
    GameRegistry.registerTileEntity(TileLeaves.class, "forestry.Leaves");
    GameRegistry.registerTileEntity(TileFruitPod.class, "forestry.Pods");
    ItemRegistryArboriculture items = getItems();
    BlockRegistryArboriculture blocks = getBlocks();
    blocks.treeChest.init();
    if (Config.enableVillagers) {
        villagerArborist = new VillagerRegistry.VillagerProfession(Constants.ID_VILLAGER_ARBORIST, Constants.TEXTURE_SKIN_LUMBERJACK, Constants.TEXTURE_SKIN_ZOMBIE_LUMBERJACK);
        ForgeRegistries.VILLAGER_PROFESSIONS.register(villagerArborist);
        VillagerRegistry.VillagerCareer arboristCareer = new VillagerRegistry.VillagerCareer(villagerArborist, "arborist");
        arboristCareer.addTrade(1, new VillagerArboristTrades.GivePlanksForEmeralds(new EntityVillager.PriceInfo(1, 1), new EntityVillager.PriceInfo(10, 32)), new VillagerArboristTrades.GivePollenForEmeralds(new EntityVillager.PriceInfo(1, 1), new EntityVillager.PriceInfo(1, 3), EnumGermlingType.SAPLING, 4));
        arboristCareer.addTrade(2, new VillagerArboristTrades.GivePlanksForEmeralds(new EntityVillager.PriceInfo(1, 1), new EntityVillager.PriceInfo(10, 32)), new VillagerTradeLists.GiveItemForEmeralds(new EntityVillager.PriceInfo(1, 4), items.grafterProven.getItemStack(), new EntityVillager.PriceInfo(1, 1)), new VillagerArboristTrades.GivePollenForEmeralds(new EntityVillager.PriceInfo(2, 3), new EntityVillager.PriceInfo(1, 1), EnumGermlingType.POLLEN, 6));
        arboristCareer.addTrade(3, new VillagerArboristTrades.GiveLogsForEmeralds(new EntityVillager.PriceInfo(2, 5), new EntityVillager.PriceInfo(6, 18)), new VillagerArboristTrades.GiveLogsForEmeralds(new EntityVillager.PriceInfo(2, 5), new EntityVillager.PriceInfo(6, 18)));
        arboristCareer.addTrade(4, new VillagerArboristTrades.GivePollenForEmeralds(new EntityVillager.PriceInfo(5, 20), new EntityVillager.PriceInfo(1, 1), EnumGermlingType.POLLEN, 10), new VillagerArboristTrades.GivePollenForEmeralds(new EntityVillager.PriceInfo(5, 20), new EntityVillager.PriceInfo(1, 1), EnumGermlingType.SAPLING, 10));
    }
}
Also used : BlockRegistryArboriculture(forestry.arboriculture.blocks.BlockRegistryArboriculture) ItemRegistryArboriculture(forestry.arboriculture.items.ItemRegistryArboriculture) VillagerTradeLists(forestry.core.utils.VillagerTradeLists) VillagerRegistry(net.minecraftforge.fml.common.registry.VillagerRegistry)

Example 5 with ItemRegistryArboriculture

use of forestry.arboriculture.items.ItemRegistryArboriculture 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)

Aggregations

ItemRegistryArboriculture (forestry.arboriculture.items.ItemRegistryArboriculture)6 BlockRegistryArboriculture (forestry.arboriculture.blocks.BlockRegistryArboriculture)3 Item (net.minecraft.item.Item)2 ItemStack (net.minecraft.item.ItemStack)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 EnumForestryWoodType (forestry.api.arboriculture.EnumForestryWoodType)1 EnumGermlingType (forestry.api.arboriculture.EnumGermlingType)1 ITree (forestry.api.arboriculture.ITree)1 IWoodType (forestry.api.arboriculture.IWoodType)1 BlockArbLog (forestry.arboriculture.blocks.BlockArbLog)1 ItemRegistryCore (forestry.core.items.ItemRegistryCore)1 VillagerTradeLists (forestry.core.utils.VillagerTradeLists)1 ArrayList (java.util.ArrayList)1 Nullable (javax.annotation.Nullable)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 VillagerRegistry (net.minecraftforge.fml.common.registry.VillagerRegistry)1