public void tryGrow(Random random, boolean bonemealed) { ITree tree = getTree(); if (tree == null) { return; } int maturity = getRequiredMaturity(world, tree); if (timesTicked < maturity) { if (bonemealed) { timesTicked = maturity; } return; } WorldGenerator generator = tree.getTreeGenerator(world, getPos(), bonemealed); final boolean generated; if (generator instanceof WorldGenBase) { generated = ((WorldGenBase) generator).generate(world, random, getPos(), false); } else { generated = generator.generate(world, random, getPos()); } if (generated) { IBreedingTracker breedingTracker = TreeManager.treeRoot.getBreedingTracker(world, getOwnerHandler().getOwner()); breedingTracker.registerBirth(tree); } }
public static ItemStack analyse(ItemStack stack, World world, GameProfile username) { if (!stack.isEmpty()) { ItemStack conv = Binnie.GENETICS.getConversionStack(stack).copy(); if (!conv.isEmpty()) { conv.setCount(stack.getCount()); stack = conv; } ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(stack); if (root != null) { final IIndividual ind = root.getMember(stack); ind.analyze(); IBreedingTracker breedingTracker = ind.getGenome().getSpeciesRoot().getBreedingTracker(world, username); breedingTracker.registerBirth(ind); final NBTTagCompound nbttagcompound = new NBTTagCompound(); ind.writeToNBT(nbttagcompound); stack.setTagCompound(nbttagcompound); return stack; } if (stack.getItem() instanceof IItemAnalysable) { return ((IItemAnalysable) stack.getItem()).analyse(stack); } } return stack; }