use of binnie.core.gui.controls.ControlText in project Binnie by ForestryMC.
the class PagePlanksTrees method onValueChanged.
@Override
public void onValueChanged(final ItemStack species) {
this.deleteAllChildren();
final WindowAbstractDatabase database = Window.get(this);
new ControlText(this, new Area(0, 0, this.getSize().xPos(), 24), species.getDisplayName(), TextJustification.MIDDLE_CENTER);
final Collection<IAlleleSpecies> trees = getTreesThatMakePlanks(species, database.isMaster(), database.getWorld(), database.getUsername());
new ControlSpeciesBox(this, 4, 24, this.getSize().xPos() - 8, this.getSize().yPos() - 4 - 24).setOptions(trees);
}
use of binnie.core.gui.controls.ControlText in project Binnie by ForestryMC.
the class WindowSequencer method initialiseClient.
@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
super.initialiseClient();
int x = 16;
int y = 32;
CraftGUIUtil.horizontalGrid(x, y, TextJustification.MIDDLE_CENTER, 2, new ControlSlotArray.Builder(this, 0, 0, 2, 2).create(Sequencer.SLOT_RESERVE), new ControlIconDisplay(this, 0, 0, GUIIcon.ARROW_RIGHT.getIcon().getResourceLocation()), new ControlSequencerProgress(this, 0, 0), new ControlIconDisplay(this, 0, 0, GUIIcon.ARROW_RIGHT.getIcon().getResourceLocation()), new ControlSlot.Builder(this, 0, 0).assign(6));
final ControlSlot slotTarget = new ControlSlot.Builder(this, x + 96, y + 16).assign(5);
x = 34;
y = 92;
this.slotText = new ControlText(this, new Area(0, y, this.getWidth(), 12), TextFormatting.DARK_GRAY + I18N.localise("genetics.machine.sequencer.texts.userless"), TextJustification.MIDDLE_CENTER);
y += 20;
final ControlSlot slotDye = new ControlSlot.Builder(this, x, y).assign(0);
x += 20;
new ControlSlotCharge(this, x, y, 0).setColor(16750848);
x += 32;
new ControlEnergyBar(this, x, y, 60, 16, Alignment.LEFT);
x += 92;
final ControlErrorState errorState = new ControlErrorState(this, x, y + 1);
new ControlPlayerInventory(this);
}
use of binnie.core.gui.controls.ControlText in project Binnie by ForestryMC.
the class ControlTileSelect method refresh.
public void refresh(final String filterText) {
this.deleteAllChildren();
int cx = 2;
int cy = 2;
final Map<IDesignCategory, List<IDesign>> designs = new HashMap<>();
for (final IDesignCategory category : DesignAPI.manager.getAllDesignCategories()) {
designs.put(category, new ArrayList<>());
for (final IDesign tile : category.getDesigns()) {
if (Objects.equals(filterText, "") || tile.getName().toLowerCase().contains(filterText)) {
designs.get(category).add(tile);
}
}
if (designs.get(category).isEmpty()) {
designs.remove(category);
}
}
for (final IDesignCategory category : designs.keySet()) {
cx = 2;
new ControlText(this, new Point(cx, cy + 3), category.getName());
cy += 16;
for (final IDesign tile : designs.get(category)) {
if (cx > 90) {
cx = 2;
cy += 20;
}
new ControlTile(this, cx, cy, tile);
cx += 20;
}
cy += 20;
}
final int height = cy;
this.setSize(new Point(this.getSize().xPos(), height));
}
use of binnie.core.gui.controls.ControlText in project Binnie by ForestryMC.
the class AnalystPageBeeProducts method createProductEntry.
private void createProductEntry(ItemStack key, Float value, int y, float speed) {
ControlItemDisplay item = new BeeProductItem(this, y, key);
item.setTooltip();
ControlText textWidget = new ControlTextCentered(this, y + 4, "");
textWidget.setColor(getColor());
CraftGUIUtil.moveWidget(textWidget, new Point(12, 0));
item.setItemStack(key);
int time = (int) (ModuleApiculture.ticksPerBeeWorkCycle * 100.0 / (speed * value));
textWidget.setValue(I18N.localise(AnalystConstants.PRODUCTS_KEY + ".every") + ' ' + TimeUtil.getTimeString(time));
}
use of binnie.core.gui.controls.ControlText in project Binnie by ForestryMC.
the class WindowGeneBank method initialiseClient.
@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
super.initialiseClient();
this.addEventHandler(EventValueChanged.class, event -> {
if (event.getValue() instanceof BreedingSystem) {
WindowGeneBank.this.genes.setValue((IBreedingSystem) event.getValue());
}
});
int x = 16;
final int y = 32;
new ControlPlayerInventory(this, x, y);
x += 124;
int boxX = x;
final int geneBoxWidth = 120;
new Panel(this, boxX + 24, 32, geneBoxWidth, 120, MinecraftGUI.PanelType.BLACK);
new Panel(this, boxX + 24 + geneBoxWidth, 32, 14, 120, MinecraftGUI.PanelType.GRAY);
final ControlScrollableContent<ControlGeneScroll> scroll = new ControlScrollableContent<>(this, boxX + 24 + 2, 34, geneBoxWidth + 10, 116, 12);
final ControlTextEdit edit = new ControlTextEdit(this, boxX + 27 + geneBoxWidth - 70, 18, 80, 12);
this.addEventHandler(EventTextEdit.class, EventHandlerOrigin.SELF, edit, event -> {
String value = event.getValue();
if (value == null) {
value = "";
}
WindowGeneBank.this.genes.setFilter(value);
});
this.genes = new ControlGeneScroll(scroll, 1, 1, geneBoxWidth, 116);
scroll.setScrollableContent(this.genes);
this.genes.setGenes(Binnie.GENETICS.getFirstActiveSystem());
final ControlTabBar<IBreedingSystem> tabBar = new GeneBankTabBar(this, boxX);
tabBar.setValue(Binnie.GENETICS.getFirstActiveSystem());
boxX -= 8;
final ControlTabBar<String> infoTabs = new ControlTabBar<>(this, boxX + 8, 160, 16, 50, Alignment.LEFT, Arrays.asList("Info", "Stats", "Ranking"));
final Panel panelProject = new Panel(this, boxX + 24, 160, geneBoxWidth + 20, 50, MinecraftGUI.PanelType.BLACK);
int totalGenes = 0;
int seqGenes = 0;
for (final IBreedingSystem system : Binnie.GENETICS.getActiveSystems()) {
final GeneTracker tracker = GeneTracker.getTracker(this.getWorld(), this.getUsername());
final Map<IChromosomeType, List<IAllele>> genes = Binnie.GENETICS.getChromosomeMap(system.getSpeciesRoot());
for (final Map.Entry<IChromosomeType, List<IAllele>> entry : genes.entrySet()) {
totalGenes += entry.getValue().size();
for (final IAllele allele : entry.getValue()) {
final Gene gene = new Gene(allele, entry.getKey(), system.getSpeciesRoot());
if (tracker.isSequenced(gene)) {
++seqGenes;
}
}
}
}
new ControlText(panelProject, new Point(4, 4), "§nFull Genome Project");
new ControlText(panelProject, new Point(4, 18), "§oSequenced §r" + seqGenes + '/' + totalGenes + " §oGenes");
}
Aggregations