@Override public final ItemStack getMemberStack(EnumGermlingType treeType) { ITree tree = getIndividual(); return TreeManager.treeRoot.getMemberStack(tree, treeType); }
@Override public final ItemStack getMemberStack(EnumGermlingType treeType) { ITree tree = getIndividual(); return TreeManager.treeRoot.getMemberStack(tree, treeType); }
private static ItemStack getDrop(IBlockAccess world, BlockPos pos) { TileSapling sapling = TileUtil.getTile(world, pos, TileSapling.class); if (sapling != null) { ITree tree = sapling.getTree(); if (tree != null) { return TreeManager.treeRoot.getMemberStack(tree, EnumGermlingType.SAPLING); } } return ItemStack.EMPTY; }
@Override protected void getLeafDrop(NonNullList<ItemStack> drops, World world, @Nullable GameProfile playerProfile, BlockPos pos, float saplingModifier, int fortune) { ITree tree = getTree(world, pos); if (tree == null) { return; } // Add saplings List<ITree> saplings = tree.getSaplings(world, playerProfile, pos, saplingModifier); for (ITree sapling : saplings) { if (sapling != null) { drops.add(TreeManager.treeRoot.getMemberStack(sapling, EnumGermlingType.SAPLING)); } } }
@Override protected void getLeafDrop(NonNullList<ItemStack> drops, World world, @Nullable GameProfile playerProfile, BlockPos pos, float saplingModifier, int fortune) { ITree tree = getTree(world, pos); if (tree == null) { return; } // Add saplings List<ITree> saplings = tree.getSaplings(world, playerProfile, pos, saplingModifier); for (ITree sapling : saplings) { if (sapling != null) { drops.add(TreeManager.treeRoot.getMemberStack(sapling, EnumGermlingType.SAPLING)); } } }
@Override public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { TileSapling sapling = TileUtil.getTile(world, pos, TileSapling.class); if (sapling == null || sapling.getTree() == null) { return ItemStack.EMPTY; } return TreeManager.treeRoot.getMemberStack(sapling.getTree(), EnumGermlingType.SAPLING); }
public void addCreativeItems(NonNullList<ItemStack> subItems, boolean hideSecrets) { for (IIndividual individual : TreeManager.treeRoot.getIndividualTemplates()) { // Don't show secrets unless ordered to. if (hideSecrets && individual.isSecret() && !Config.isDebug) { continue; } subItems.add(TreeManager.treeRoot.getMemberStack(individual, type)); } }
public static ItemStack convertToGeneticEquivalent(ItemStack foreign) { if (AlleleManager.alleleRegistry.getSpeciesRoot(foreign) == null) { IIndividual individual = getGeneticEquivalent(foreign); if (individual != null) { ItemStack equivalent = TreeManager.treeRoot.getMemberStack(individual, EnumGermlingType.SAPLING); equivalent.setCount(foreign.getCount()); return equivalent; } } return foreign; }
IIndividual individual = TreeManager.treeRoot.templateAsIndividual(template); ItemStack sellStack = TreeManager.treeRoot.getMemberStack(individual, type); sellStack.setCount(i);
@Override protected void getLeafDrop(NonNullList<ItemStack> drops, World world, @Nullable GameProfile playerProfile, BlockPos pos, float saplingModifier, int fortune) { ITree tree = getTree(world, pos); if (tree == null) { return; } // Add saplings List<ITree> saplings = tree.getSaplings(world, playerProfile, pos, saplingModifier); for (ITree sapling : saplings) { if (sapling != null) { drops.add(TreeManager.treeRoot.getMemberStack(sapling, EnumGermlingType.SAPLING)); } } // Add fruitsk ITreeGenome genome = tree.getGenome(); IFruitProvider fruitProvider = genome.getFruitProvider(); if (fruitProvider.isFruitLeaf(genome, world, pos)) { NonNullList<ItemStack> produceStacks = tree.produceStacks(world, pos, Integer.MAX_VALUE); drops.addAll(produceStacks); } }
@Override protected void getLeafDrop(NonNullList<ItemStack> drops, World world, @Nullable GameProfile playerProfile, BlockPos pos, float saplingModifier, int fortune) { TileLeaves tile = TileUtil.getTile(world, pos, TileLeaves.class); if (tile == null) { return; } ITree tree = tile.getTree(); if (tree == null) { return; } // Add saplings List<ITree> saplings = tree.getSaplings(world, playerProfile, pos, saplingModifier); for (ITree sapling : saplings) { if (sapling != null) { drops.add(TreeManager.treeRoot.getMemberStack(sapling, EnumGermlingType.SAPLING)); } } // Add fruits if (tile.hasFruit()) { drops.addAll(tree.produceStacks(world, pos, tile.getRipeningTime())); } }
@Override protected void getLeafDrop(NonNullList<ItemStack> drops, World world, @Nullable GameProfile playerProfile, BlockPos pos, float saplingModifier, int fortune) { ITree tree = getTree(world, pos); if (tree == null) { return; } // Add saplings List<ITree> saplings = tree.getSaplings(world, playerProfile, pos, saplingModifier); for (ITree sapling : saplings) { if (sapling != null) { drops.add(TreeManager.treeRoot.getMemberStack(sapling, EnumGermlingType.SAPLING)); } } // Add fruitsk ITreeGenome genome = tree.getGenome(); IFruitProvider fruitProvider = genome.getFruitProvider(); if (fruitProvider.isFruitLeaf(genome, world, pos)) { NonNullList<ItemStack> produceStacks = tree.produceStacks(world, pos, Integer.MAX_VALUE); drops.addAll(produceStacks); } }
@Override public void postInit() { IFarmProperties orchardFarm = FarmRegistry.getInstance().getProperties(ForestryFarmIdentifier.ORCHARD); if (orchardFarm != null && ModuleHelper.isEnabled(ForestryModuleUids.ARBORICULTURE)) { ITreeRoot treeRoot = TreeManager.treeRoot; if (treeRoot != null) { for (ITree tree : treeRoot.getIndividualTemplates()) { IFruitProvider fruitProvider = tree.getGenome().getFruitProvider(); if (fruitProvider != AlleleFruits.fruitNone.getProvider()) { orchardFarm.addGermlings(treeRoot.getMemberStack(tree, EnumGermlingType.SAPLING)); orchardFarm.addProducts(fruitProvider.getProducts().keySet()); orchardFarm.addProducts(fruitProvider.getSpecialty().keySet()); } } } } }
@Override public ItemStack getIcon() { Item iconItem; switch (icon) { case 1: iconItem = ForgeRegistries.ITEMS.getValue(new ResourceLocation(Constants.MOD_ID, "ffarm")); break; case 2: return BeeManager.beeRoot.getMemberStack(new Bee(BeeDefinition.FOREST.getGenome()), EnumBeeType.DRONE); case 3: return TreeManager.treeRoot.getMemberStack(new Tree(TreeDefinition.Oak.getGenome()), EnumGermlingType.SAPLING); case 4: return ButterflyManager.butterflyRoot.getMemberStack(new Butterfly(ButterflyDefinition.Brimstone.getGenome()), EnumFlutterType.BUTTERFLY); default: iconItem = ForgeRegistries.ITEMS.getValue(new ResourceLocation(Constants.MOD_ID, "fertilizerCompound")); break; } if (iconItem == null) { iconItem = ModuleCore.getItems().wrench; } return new ItemStack(iconItem); }