use of forestry.api.arboriculture.EnumGermlingType in project ForestryMC by ForestryMC.
the class TreeAlyzerPlugin method drawAnalyticsPage1.
@SideOnly(Side.CLIENT)
@Override
public void drawAnalyticsPage1(GuiScreen gui, ItemStack itemStack) {
if (gui instanceof GuiAlyzer) {
GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
ITree tree = TreeManager.treeRoot.getMember(itemStack);
if (tree == null) {
return;
}
EnumGermlingType type = TreeManager.treeRoot.getType(itemStack);
if (type == null) {
return;
}
TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
textLayout.newLine();
textLayout.newLine();
{
String customPrimaryTreeKey = "trees.custom.treealyzer." + type.getName() + "." + tree.getGenome().getPrimary().getUnlocalizedName().replace("trees.species.", "");
String customSecondaryTreeKey = "trees.custom.treealyzer." + type.getName() + "." + tree.getGenome().getSecondary().getUnlocalizedName().replace("trees.species.", "");
guiAlyzer.drawSpeciesRow(Translator.translateToLocal("for.gui.species"), tree, EnumTreeChromosome.SPECIES, GuiAlyzer.checkCustomName(customPrimaryTreeKey), GuiAlyzer.checkCustomName(customSecondaryTreeKey));
textLayout.newLine();
}
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.saplings"), tree, EnumTreeChromosome.FERTILITY);
textLayout.newLineCompressed();
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.maturity"), tree, EnumTreeChromosome.MATURATION);
textLayout.newLineCompressed();
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.height"), tree, EnumTreeChromosome.HEIGHT);
textLayout.newLineCompressed();
IAlleleInteger activeGirth = (IAlleleInteger) tree.getGenome().getActiveAllele(EnumTreeChromosome.GIRTH);
IAlleleInteger inactiveGirth = (IAlleleInteger) tree.getGenome().getInactiveAllele(EnumTreeChromosome.GIRTH);
textLayout.drawLine(Translator.translateToLocal("for.gui.girth"), GuiAlyzer.COLUMN_0);
guiAlyzer.drawLine(String.format("%sx%s", activeGirth.getValue(), activeGirth.getValue()), GuiAlyzer.COLUMN_1, tree, EnumTreeChromosome.GIRTH, false);
guiAlyzer.drawLine(String.format("%sx%s", inactiveGirth.getValue(), inactiveGirth.getValue()), GuiAlyzer.COLUMN_2, tree, EnumTreeChromosome.GIRTH, true);
textLayout.newLineCompressed();
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.yield"), tree, EnumTreeChromosome.YIELD);
textLayout.newLineCompressed();
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.sappiness"), tree, EnumTreeChromosome.SAPPINESS);
textLayout.newLineCompressed();
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.effect"), tree, EnumTreeChromosome.EFFECT);
textLayout.endPage();
}
}
use of forestry.api.arboriculture.EnumGermlingType 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;
}
Aggregations