use of binnie.core.gui.geometry.Area in project Binnie by ForestryMC.
the class PageSpeciesTreeGenome method onValueChanged.
// TODO: unused ?
/*public static String tolerated(final boolean t) {
if (t) {
return I18N.localise("binniecore.gui.tolerated");
}
return I18N.localise("binniecore.gui.nottolerated");
}*/
@Override
public void onValueChanged(final IAlleleSpecies species) {
this.deleteAllChildren();
final IAllele[] template = TreeManager.treeRoot.getTemplate(species.getUID());
if (template == null) {
return;
}
final ITree tree = TreeManager.treeRoot.templateAsIndividual(template);
final ITreeGenome genome = tree.getGenome();
final IAlleleTreeSpecies treeSpecies = genome.getPrimary();
final int w = 144;
final int h = 176;
new ControlText(this, new Area(0, 4, w, 16), this.getValue().toString(), TextJustification.MIDDLE_CENTER);
final ControlScrollableContent scrollable = new ControlScrollableContent(this, 4, 20, w - 8, h - 8 - 16, 12);
final Control contents = new Control(scrollable, 0, 0, w - 8 - 12, h - 8 - 16);
final int tw = w - 8 - 12;
final int w2 = 65;
final int w3 = tw - 50;
int y = 0;
final int th = 14;
final int th2 = 18;
final IBreedingSystem syst = Binnie.GENETICS.getSystem(TreeManager.treeRoot);
new ControlText(contents, new Area(w2, y, w3, th), treeSpecies.getPlantType().toString(), TextJustification.MIDDLE_LEFT);
y += th;
new ControlText(contents, new Area(0, y, w2, th), I18N.localise("binniecore.gui.temperature.short") + " : ", TextJustification.MIDDLE_RIGHT);
new ControlText(contents, new Area(w2, y, w3, th), treeSpecies.getTemperature().getName(), TextJustification.MIDDLE_LEFT);
y += th;
Minecraft minecraft = Minecraft.getMinecraft();
World world = minecraft.world;
TextureMap map = minecraft.getTextureMapBlocks();
ILeafSpriteProvider spriteProvider = treeSpecies.getLeafSpriteProvider();
TextureAtlasSprite leaf = map.getAtlasSprite(spriteProvider.getSprite(false, false).toString());
int leafColour = spriteProvider.getColor(false);
new ControlText(contents, new Area(0, y, w2, th2), I18N.localise("extratrees.gui.database.leaves") + " : ", TextJustification.MIDDLE_RIGHT);
new ControlBlockIconDisplay(contents, w2, y, leaf).setColor(leafColour);
IFruitProvider fruitProvider = genome.getFruitProvider();
ResourceLocation fruitSprite = fruitProvider.getSprite(genome, world, BlockPos.ORIGIN, 100);
if (fruitSprite != null && !treeSpecies.getUID().equals("forestry.treeOak")) {
TextureAtlasSprite fruit = map.getAtlasSprite(fruitSprite.toString());
int fruitColour = fruitProvider.getColour(genome, world, BlockPos.ORIGIN, 100);
new ControlBlockIconDisplay(contents, w2, y, fruit).setColor(fruitColour);
}
y += th2;
Map<ItemStack, Float> products = fruitProvider.getProducts();
ItemStack log = treeSpecies.getWoodProvider().getWoodStack();
if (log.isEmpty()) {
new ControlText(contents, new Area(0, y, w2, th2), I18N.localise("extratrees.gui.database.log") + " : ", TextJustification.MIDDLE_RIGHT);
final ControlItemDisplay display = new ControlItemDisplay(contents, w2, y);
display.setItemStack(log);
display.setTooltip();
y += th2;
}
new ControlText(contents, new Area(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.HEIGHT) + " : ", TextJustification.MIDDLE_RIGHT);
new ControlText(contents, new Area(w2, y, w3, th), genome.getHeight() + "x", TextJustification.MIDDLE_LEFT);
y += th;
new ControlText(contents, new Area(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.FERTILITY) + " : ", TextJustification.MIDDLE_RIGHT);
new ControlText(contents, new Area(w2, y, w3, th), genome.getFertility() + "x", TextJustification.MIDDLE_LEFT);
y += th;
List<ItemStack> fruits = new ArrayList<>(products.keySet());
if (!fruits.isEmpty()) {
new ControlText(contents, new Area(0, y, w2, th2), syst.getChromosomeShortName(EnumTreeChromosome.FRUITS) + " : ", TextJustification.MIDDLE_RIGHT);
for (ItemStack fruitw : fruits) {
final ControlItemDisplay display2 = new ControlItemDisplay(contents, w2, y);
display2.setItemStack(fruitw);
display2.setTooltip();
y += th2;
}
}
new ControlText(contents, new Area(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.YIELD) + " : ", TextJustification.MIDDLE_RIGHT);
new ControlText(contents, new Area(w2, y, w3, th), genome.getYield() + "x", TextJustification.MIDDLE_LEFT);
y += th;
new ControlText(contents, new Area(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.SAPPINESS) + " : ", TextJustification.MIDDLE_RIGHT);
new ControlText(contents, new Area(w2, y, w3, th), genome.getSappiness() + "x", TextJustification.MIDDLE_LEFT);
y += th;
new ControlText(contents, new Area(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.MATURATION) + " : ", TextJustification.MIDDLE_RIGHT);
new ControlText(contents, new Area(w2, y, w3, th), genome.getMaturationTime() + "x", TextJustification.MIDDLE_LEFT);
y += th;
new ControlText(contents, new Area(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.GIRTH) + " : ", TextJustification.MIDDLE_RIGHT);
new ControlText(contents, new Area(w2, y, w3, th), genome.getGirth() + "x" + genome.getGirth(), TextJustification.MIDDLE_LEFT);
y += th;
contents.setSize(new Point(contents.getSize().xPos(), y));
scrollable.setScrollableContent(contents);
}
use of binnie.core.gui.geometry.Area in project Binnie by ForestryMC.
the class DistilleryRecipeCategory method drawExtras.
@Override
@SideOnly(Side.CLIENT)
public void drawExtras(Minecraft minecraft) {
CraftGUI.RENDER.texture(DISTILLERY_BASE, Point.ZERO);
CraftGUI.RENDER.texturePercentage(LIQUID_FLOW, new Area(18, 0, 38, 60), Alignment.LEFT, progress.getValue() / 100f);
}
use of binnie.core.gui.geometry.Area in project Binnie by ForestryMC.
the class ControlSlotFluid method onRenderBackground.
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
final int size = this.getSize().xPos();
CraftGUI.RENDER.texture(CraftGUITexture.SLOT, this.getArea());
if (this.getTopParent().getMousedOverWidget() == this) {
RenderUtil.drawGradientRect(new Area(new Point(1, 1), this.getArea().size().sub(new Point(2, 2))), -2130706433, -2130706433);
}
}
use of binnie.core.gui.geometry.Area in project Binnie by ForestryMC.
the class ControlSplicerProgress method onRenderBackground.
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
final float progress = this.getProcess().getCurrentProgress() / 100.0f;
final float n = this.getProcess().getProcessTime() / 12.0f;
final int spacing = 10;
final float range = this.getWidth();
final int h = 8;
final float ooy = -((n - 1.0f) * spacing) - range / 2.0f;
final float ddy = (n - 1.0f) * spacing + range;
final int oy = Math.round(ooy + ddy * progress);
for (int i = 0; i < n; ++i) {
final int seed = 432523;
final int[] colours = { 10027008, 30464, 255, 10057472 };
int c1 = colours[(int) Math.abs(13.0 * Math.sin(i) + 48.0 * Math.cos(i) + 25.0 * Math.sin(7 * i)) % 4];
int c2 = colours[(int) Math.abs(23.0 * Math.sin(i) + 28.0 * Math.cos(i) + 15.0 * Math.sin(7 * i)) % 4];
int c3 = colours[(int) Math.abs(43.0 * Math.sin(i) + 38.0 * Math.cos(i) + 55.0 * Math.sin(7 * i)) % 4];
int c4 = colours[(int) Math.abs(3.0 * Math.sin(i) + 18.0 * Math.cos(i) + 35.0 * Math.sin(7 * i)) % 4];
final int y = oy + i * spacing;
if (y > -range / 2.0f && y < range / 2.0f) {
final float percentView = (float) Math.sqrt(1.0f - Math.abs(2.0f * y / range));
final float offMovement = (this.getHeight() - 2.0f * h) / 2.0f;
final int alpha = 16777216 * (int) (255.0f * percentView);
c1 += alpha;
c2 += alpha;
c3 += alpha;
c4 += alpha;
int viewAmount = Math.round(offMovement * percentView);
RenderUtil.drawSolidRectWithAlpha(new Area(this.getWidth() / 2 + y, viewAmount, 4, h / 2), c1);
RenderUtil.drawSolidRectWithAlpha(new Area(this.getWidth() / 2 + y, viewAmount + 4, 4, h / 2), (y < 0) ? c2 : c3);
RenderUtil.drawSolidRectWithAlpha(new Area(this.getWidth() / 2 + y, this.getHeight() - viewAmount - 8, 4, h / 2), (y < 0) ? c3 : c2);
RenderUtil.drawSolidRectWithAlpha(new Area(this.getWidth() / 2 + y, this.getHeight() - viewAmount - 4, 4, h / 2), c4);
}
}
}
use of binnie.core.gui.geometry.Area in project Binnie by ForestryMC.
the class ControlBiomes method onRenderForeground.
@Override
@SideOnly(Side.CLIENT)
public void onRenderForeground(int guiWidth, int guiHeight) {
for (int i = 0; i < tolerated.size(); ++i) {
int x = i % 8 * 16;
int y = i / 8 * 16;
if (Biome.getBiome(i) != null) {
// TODO FIND COLOR
// CraftGUI.Render.colour(Biome.getBiome(i).color);
}
CraftGUI.RENDER.texture(CraftGUITexture.BUTTON, new Area(x, y, 16, 16));
}
}
Aggregations