mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-25 14:34:33 +00:00
Fix soil item model and start to move craftgui
This commit is contained in:
1 parent
de2dc3dabb
commit
3ed915f9d5
12 files changed
+14
-16
No files matched your search
@@ -1,41 +0,0 @@
|
||||
package binnie.craftgui.botany;
|
||||
|
||||
import binnie.botany.api.IFlowerColour;
|
||||
import binnie.craftgui.controls.core.Control;
|
||||
import binnie.craftgui.controls.core.IControlValue;
|
||||
import binnie.craftgui.core.Attribute;
|
||||
import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.core.ITooltip;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.Tooltip;
|
||||
|
||||
public class ControlColourDisplay extends Control implements IControlValue<IFlowerColour>, ITooltip {
|
||||
IFlowerColour value;
|
||||
|
||||
public ControlColourDisplay(final IWidget parent, final float x, final float y) {
|
||||
super(parent, x, y, 16.0f, 16.0f);
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerColour getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(final IFlowerColour value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.Render.solid(this.getArea(), -1);
|
||||
CraftGUI.Render.solid(this.getArea().inset(1), -16777216 + this.getValue().getColor(false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(final Tooltip tooltip) {
|
||||
super.getTooltip(tooltip);
|
||||
tooltip.add(this.value.getColourName());
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package binnie.craftgui.botany;
|
||||
|
||||
import binnie.botany.api.IColourMix;
|
||||
import binnie.craftgui.controls.listbox.ControlListBox;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
|
||||
public class ControlColourMixBox extends ControlListBox<IColourMix> {
|
||||
private int index;
|
||||
private Type type;
|
||||
|
||||
@Override
|
||||
public IWidget createOption(final IColourMix value, final int y) {
|
||||
return new ControlColourMixItem(this.getContent(), value, y);
|
||||
}
|
||||
|
||||
public ControlColourMixBox(final IWidget parent, final int x, final int y, final int width, final int height, final Type type) {
|
||||
super(parent, x, y, width, height, 12.0f);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
enum Type {
|
||||
Resultant,
|
||||
Further;
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package binnie.craftgui.botany;
|
||||
|
||||
import binnie.botany.api.IColourMix;
|
||||
import binnie.core.genetics.BreedingSystem;
|
||||
import binnie.craftgui.controls.listbox.ControlList;
|
||||
import binnie.craftgui.controls.listbox.ControlOption;
|
||||
import binnie.craftgui.mod.database.WindowAbstractDatabase;
|
||||
|
||||
public class ControlColourMixItem extends ControlOption<IColourMix> {
|
||||
ControlColourDisplay itemWidget1;
|
||||
ControlColourDisplay itemWidget2;
|
||||
ControlColourDisplay itemWidget3;
|
||||
ControlColourMixSymbol addSymbol;
|
||||
ControlColourMixSymbol arrowSymbol;
|
||||
|
||||
public ControlColourMixItem(final ControlList<IColourMix> controlList, final IColourMix option, final int y) {
|
||||
super(controlList, option, y);
|
||||
this.itemWidget1 = new ControlColourDisplay(this, 4.0f, 4.0f);
|
||||
this.itemWidget2 = new ControlColourDisplay(this, 44.0f, 4.0f);
|
||||
this.itemWidget3 = new ControlColourDisplay(this, 104.0f, 4.0f);
|
||||
this.addSymbol = new ControlColourMixSymbol(this, 24, 4, 0);
|
||||
this.arrowSymbol = new ControlColourMixSymbol(this, 64, 4, 1);
|
||||
final BreedingSystem system = ((WindowAbstractDatabase) this.getSuperParent()).getBreedingSystem();
|
||||
if (this.getValue() != null) {
|
||||
this.itemWidget1.setValue(this.getValue().getColourFirst());
|
||||
this.itemWidget2.setValue(this.getValue().getColourSecond());
|
||||
this.itemWidget3.setValue(this.getValue().getResult());
|
||||
this.addSymbol.setValue(this.getValue());
|
||||
this.arrowSymbol.setValue(this.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package binnie.craftgui.botany;
|
||||
|
||||
import binnie.botany.api.IColourMix;
|
||||
import binnie.craftgui.controls.core.Control;
|
||||
import binnie.craftgui.core.Attribute;
|
||||
import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.core.ITooltip;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.Tooltip;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.resource.Texture;
|
||||
import binnie.craftgui.resource.minecraft.CraftGUITextureSheet;
|
||||
import binnie.craftgui.resource.minecraft.StandardTexture;
|
||||
|
||||
public class ControlColourMixSymbol extends Control implements ITooltip {
|
||||
static Texture MutationPlus = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.Controls2);
|
||||
static Texture MutationArrow = new StandardTexture(20, 94, 32, 16, CraftGUITextureSheet.Controls2);
|
||||
IColourMix value;
|
||||
int type;
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
super.onRenderBackground();
|
||||
if (this.type == 0) {
|
||||
CraftGUI.Render.texture(ControlColourMixSymbol.MutationPlus, IPoint.ZERO);
|
||||
} else {
|
||||
CraftGUI.Render.texture(ControlColourMixSymbol.MutationArrow, IPoint.ZERO);
|
||||
}
|
||||
}
|
||||
|
||||
protected ControlColourMixSymbol(final IWidget parent, final int x, final int y, final int type) {
|
||||
super(parent, x, y, 16 + type * 16, 16.0f);
|
||||
this.value = null;
|
||||
this.type = type;
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
}
|
||||
|
||||
public void setValue(final IColourMix value) {
|
||||
this.value = value;
|
||||
this.setColour(16777215);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(final Tooltip tooltip) {
|
||||
if (this.type == 1) {
|
||||
final float chance = this.value.getChance();
|
||||
tooltip.add("Current Chance - " + chance + "%");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package binnie.craftgui.botany;
|
||||
|
||||
import binnie.botany.api.IFlowerColour;
|
||||
import binnie.craftgui.controls.listbox.ControlList;
|
||||
import binnie.craftgui.controls.listbox.ControlTextOption;
|
||||
import binnie.craftgui.core.Attribute;
|
||||
import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.core.geometry.CraftGUIUtil;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
|
||||
public class ControlColourOption extends ControlTextOption<IFlowerColour> {
|
||||
ControlColourDisplay controlBee;
|
||||
IPoint boxPosition;
|
||||
|
||||
public ControlColourOption(final ControlList<IFlowerColour> controlList, final IFlowerColour option, final int y) {
|
||||
super(controlList, option, option.getColourName(), y);
|
||||
this.setSize(new IPoint(this.getSize().x(), 20.0f));
|
||||
(this.controlBee = new ControlColourDisplay(this, 2.0f, 2.0f)).setValue(option);
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
CraftGUIUtil.moveWidget(this.textWidget, new IPoint(22.0f, 0.0f));
|
||||
this.textWidget.setSize(this.textWidget.getSize().sub(new IPoint(24.0f, 0.0f)));
|
||||
final int th = (int) CraftGUI.Render.textHeight(this.textWidget.getValue(), this.textWidget.getSize().x());
|
||||
final int height = Math.max(20, th + 6);
|
||||
this.setSize(new IPoint(this.size().x(), height));
|
||||
this.textWidget.setSize(new IPoint(this.textWidget.getSize().x(), height));
|
||||
this.boxPosition = new IPoint(2.0f, (height - 18) / 2);
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package binnie.craftgui.botany;
|
||||
|
||||
import binnie.botany.api.IColourMix;
|
||||
import binnie.botany.api.IFlowerColour;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.craftgui.controls.ControlText;
|
||||
import binnie.craftgui.controls.ControlTextCentered;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.mod.database.DatabaseTab;
|
||||
import binnie.craftgui.mod.database.PageAbstract;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PageColourMix extends PageAbstract<IFlowerColour> {
|
||||
ControlText pageSpeciesFurther_Title;
|
||||
ControlColourMixBox pageSpeciesFurther_List;
|
||||
|
||||
public PageColourMix(final IWidget parent, final DatabaseTab tab) {
|
||||
super(parent, tab);
|
||||
this.pageSpeciesFurther_Title = new ControlTextCentered(this, 8.0f, "Further Mixes");
|
||||
this.pageSpeciesFurther_List = new ControlColourMixBox(this, 4, 20, 136, 152, ControlColourMixBox.Type.Further);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValueChanged(final IFlowerColour colour) {
|
||||
final List<IColourMix> mixes = new ArrayList<>();
|
||||
for (final IColourMix mix : BotanyCore.getFlowerRoot().getColourMixes(false)) {
|
||||
if (mix.getColourFirst() == colour || mix.getColourSecond() == colour) {
|
||||
mixes.add(mix);
|
||||
}
|
||||
}
|
||||
this.pageSpeciesFurther_List.setOptions(mixes);
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package binnie.craftgui.botany;
|
||||
|
||||
import binnie.botany.api.IColourMix;
|
||||
import binnie.botany.api.IFlowerColour;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.craftgui.controls.ControlText;
|
||||
import binnie.craftgui.controls.ControlTextCentered;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.mod.database.DatabaseTab;
|
||||
import binnie.craftgui.mod.database.PageAbstract;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PageColourMixResultant extends PageAbstract<IFlowerColour> {
|
||||
ControlText pageSpeciesFurther_Title;
|
||||
ControlColourMixBox pageSpeciesFurther_List;
|
||||
|
||||
public PageColourMixResultant(final IWidget parent, final DatabaseTab tab) {
|
||||
super(parent, tab);
|
||||
this.pageSpeciesFurther_Title = new ControlTextCentered(this, 8.0f, "Resultant Mixes");
|
||||
this.pageSpeciesFurther_List = new ControlColourMixBox(this, 4, 20, 136, 152, ControlColourMixBox.Type.Resultant);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValueChanged(final IFlowerColour colour) {
|
||||
final List<IColourMix> mixes = new ArrayList<>();
|
||||
for (final IColourMix mix : BotanyCore.getFlowerRoot().getColourMixes(false)) {
|
||||
if (mix.getResult() == colour) {
|
||||
mixes.add(mix);
|
||||
}
|
||||
}
|
||||
this.pageSpeciesFurther_List.setOptions(mixes);
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
package binnie.craftgui.botany;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.craftgui.controls.ControlText;
|
||||
import binnie.craftgui.controls.core.Control;
|
||||
import binnie.craftgui.controls.scroll.ControlScrollableContent;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.geometry.IArea;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.geometry.TextJustification;
|
||||
import binnie.craftgui.minecraft.control.ControlItemDisplay;
|
||||
import binnie.craftgui.mod.database.DatabaseTab;
|
||||
import binnie.craftgui.mod.database.PageSpecies;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class PageSpeciesFlowerGenome extends PageSpecies {
|
||||
public PageSpeciesFlowerGenome(final IWidget parent, final DatabaseTab tab) {
|
||||
super(parent, tab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValueChanged(final IAlleleSpecies species) {
|
||||
this.deleteAllChildren();
|
||||
final IAllele[] template = Binnie.Genetics.getFlowerRoot().getTemplate(species.getUID());
|
||||
if (template == null) {
|
||||
return;
|
||||
}
|
||||
final IFlower tree = Binnie.Genetics.getFlowerRoot().templateAsIndividual(template);
|
||||
if (tree == null) {
|
||||
return;
|
||||
}
|
||||
final IFlowerGenome genome = tree.getGenome();
|
||||
final IAlleleFlowerSpecies treeSpecies = genome.getPrimary();
|
||||
final int w = 144;
|
||||
final int h = 176;
|
||||
new ControlText(this, new IArea(0.0f, 4.0f, w, 16.0f), "Genome", TextJustification.MiddleCenter);
|
||||
final ControlScrollableContent scrollable = new ControlScrollableContent(this, 4.0f, 20.0f, w - 8, h - 8 - 16, 12.0f);
|
||||
final Control contents = new Control(scrollable, 0.0f, 0.0f, w - 8 - 12, h - 8 - 16);
|
||||
final int tw = w - 8 - 12;
|
||||
final int w2 = 55;
|
||||
final int w3 = tw - 50;
|
||||
int y = 0;
|
||||
final int th = 14;
|
||||
final int th2 = 18;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), "Temp. : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), treeSpecies.getTemperature().getName(), TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), "Moist. : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), Binnie.Language.localise(treeSpecies.getMoisture()), TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), "pH. : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), Binnie.Language.localise(treeSpecies.getPH()), TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), "Fertility : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), genome.getFertility() + "x", TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
final float lifespan = genome.getLifespan() * 68.27f / genome.getAgeChance() / 24000.0f;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), "Lifespan : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), "" + String.format("%.2f", lifespan) + " days", TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), "Nectar : ", TextJustification.MiddleRight);
|
||||
new ControlText(contents, new IArea(w2, y, w3, th), genome.getActiveAllele(EnumFlowerChromosome.SAPPINESS).getName(), TextJustification.MiddleLeft);
|
||||
y += th;
|
||||
int x = w2;
|
||||
int tot = 0;
|
||||
for (final IIndividual vid : BotanyCore.getFlowerRoot().getIndividualTemplates()) {
|
||||
if (vid.getGenome().getPrimary() == treeSpecies) {
|
||||
if (tot > 0 && tot % 3 == 0) {
|
||||
x -= 54;
|
||||
y += 18;
|
||||
}
|
||||
final ItemStack stack = BotanyCore.getFlowerRoot().getMemberStack(vid, EnumFlowerStage.FLOWER);
|
||||
final ControlItemDisplay display = new ControlItemDisplay(contents, x, y);
|
||||
display.setItemStack(stack);
|
||||
++tot;
|
||||
x += 18;
|
||||
}
|
||||
}
|
||||
final int numOfLines = 1 + (tot - 1) / 3;
|
||||
new ControlText(contents, new IArea(0.0f, y - (numOfLines - 1) * 18, w2, 4 + 18 * numOfLines), "Varieties : ", TextJustification.MiddleRight);
|
||||
y += th;
|
||||
contents.setSize(new IPoint(contents.size().x(), y));
|
||||
scrollable.setScrollableContent(contents);
|
||||
}
|
||||
|
||||
public static String tolerated(final boolean t) {
|
||||
if (t) {
|
||||
return "Tolerated";
|
||||
}
|
||||
return "Not Tolerated";
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
package binnie.craftgui.botany;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.IFlowerColour;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.craftgui.controls.listbox.ControlListBox;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.geometry.IArea;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
import binnie.craftgui.mod.database.DatabaseTab;
|
||||
import binnie.craftgui.mod.database.IDatabaseMode;
|
||||
import binnie.craftgui.mod.database.PageBranchOverview;
|
||||
import binnie.craftgui.mod.database.PageBranchSpecies;
|
||||
import binnie.craftgui.mod.database.PageBreeder;
|
||||
import binnie.craftgui.mod.database.PageSpeciesClassification;
|
||||
import binnie.craftgui.mod.database.PageSpeciesMutations;
|
||||
import binnie.craftgui.mod.database.PageSpeciesOverview;
|
||||
import binnie.craftgui.mod.database.PageSpeciesResultant;
|
||||
import binnie.craftgui.mod.database.WindowAbstractDatabase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class WindowBotanistDatabase extends WindowAbstractDatabase {
|
||||
ControlListBox<EnumFlowerColor> selectionBoxColors;
|
||||
|
||||
public WindowBotanistDatabase(final EntityPlayer player, final Side side, final boolean nei) {
|
||||
super(player, side, nei, Binnie.Genetics.flowerBreedingSystem, 130.0f);
|
||||
}
|
||||
|
||||
public static Window create(final EntityPlayer player, final Side side, final boolean nei) {
|
||||
return new WindowBotanistDatabase(player, side, nei);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addTabs() {
|
||||
new PageSpeciesOverview(this.getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.overview", 0));
|
||||
new PageSpeciesFlowerGenome(this.getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.genome", 0));
|
||||
new PageSpeciesClassification(this.getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.classification", 0));
|
||||
new PageSpeciesResultant(this.getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.resultant", 0));
|
||||
new PageSpeciesMutations(this.getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.further", 0));
|
||||
new PageBranchOverview(this.getInfoPages(Mode.Branches), new DatabaseTab(Botany.instance, "branches.overview", 0));
|
||||
new PageBranchSpecies(this.getInfoPages(Mode.Branches), new DatabaseTab(Botany.instance, "branches.species", 0));
|
||||
this.createMode(FlowerMode.Colour, new ModeWidgets(FlowerMode.Colour, this) {
|
||||
@Override
|
||||
public void createListBox(final IArea area) {
|
||||
this.listBox = new ControlListBox<IFlowerColour>(this.modePage, area.x(), area.y(), area.w(), area.h(), 12.0f) {
|
||||
@Override
|
||||
public IWidget createOption(final IFlowerColour value, final int y) {
|
||||
return new ControlColourOption(this.getContent(), value, y);
|
||||
}
|
||||
};
|
||||
final List<IFlowerColour> colors = new ArrayList<>();
|
||||
Collections.addAll(colors, EnumFlowerColor.values());
|
||||
this.listBox.setOptions(colors);
|
||||
}
|
||||
});
|
||||
new PageColourMixResultant(this.getInfoPages(FlowerMode.Colour), new DatabaseTab(Botany.instance, "colour.resultant", 0));
|
||||
new PageColourMix(this.getInfoPages(FlowerMode.Colour), new DatabaseTab(Botany.instance, "colour.further", 0));
|
||||
new PageBreeder(this.getInfoPages(Mode.Breeder), this.getUsername(), new DatabaseTab(Botany.instance, "breeder", 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Botany.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBackgroundTextureName() {
|
||||
return "FlowerDatabase";
|
||||
}
|
||||
|
||||
enum FlowerMode implements IDatabaseMode {
|
||||
Colour;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return Botany.proxy.localise("gui.database.mode." + this.name().toLowerCase());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user