use of binnie.core.gui.controls.ControlTextCentered in project Binnie by ForestryMC.
the class PageBranchOverview method onValueChanged.
@Override
public void onValueChanged(final IClassification branch) {
this.branchName.setValue(TextFormatting.UNDERLINE + I18N.localise(DatabaseConstants.BRANCH_KEY + ".name", branch.getName()));
this.branchScientific.setValue(TextFormatting.ITALIC + I18N.localise(DatabaseConstants.BRANCH_KEY + ".apidae", branch.getScientific()));
this.branchAuthority.setValue(I18N.localise(DatabaseConstants.BRANCH_KEY + ".discoveredBy", TextFormatting.BOLD + branch.getMemberSpecies()[0].getAuthority()));
for (final IWidget widget : this.branchDescription) {
this.deleteChild(widget);
}
this.branchDescription.clear();
String desc = branch.getDescription();
if (desc == null || Objects.equals(desc, "") || desc.contains("for.")) {
desc = I18N.localise(DatabaseConstants.BRANCH_KEY + ".noDesc");
}
StringBuilder line = new StringBuilder();
final List<String> descLines = new ArrayList<>();
for (final String str : desc.split(" ")) {
if (RenderUtil.getTextWidth(line + " " + str) > 134) {
descLines.add(TextFormatting.ITALIC + line.toString() + TextFormatting.RESET);
line = new StringBuilder();
}
line.append(' ').append(str);
}
descLines.add(line.toString());
int i = 0;
for (final String dLine : descLines) {
this.branchDescription.add(new ControlTextCentered(this, 84 + 12 * i++, dLine));
}
}
use of binnie.core.gui.controls.ControlTextCentered in project Binnie by ForestryMC.
the class PageBreeder method onPageRefresh.
public void onPageRefresh() {
this.deleteAllChildren();
final IBreedingSystem system = ((WindowAbstractDatabase) Window.get(this)).getBreedingSystem();
new ControlTextCentered(this, 8, TextFormatting.UNDERLINE + system.getDescriptor() + ' ' + I18N.localise(DatabaseConstants.BREEDER_KEY + ".profile"));
new ControlTextCentered(this, 75, system.getDiscoveredSpeciesCount() + '/' + system.getTotalSpeciesCount() + ' ' + I18N.localise(DatabaseConstants.BREEDER_KEY + ".species"));
new ControlBreedingProgress(this, 20, 87, 102, 14, system, system.getDiscoveredSpeciesPercentage());
new ControlTextCentered(this, 115, system.getDiscoveredBranchCount() + '/' + system.getTotalBranchCount() + ' ' + I18N.localise(DatabaseConstants.BREEDER_KEY + ".branches"));
new ControlBreedingProgress(this, 20, 127, 102, 14, system, system.getDiscoveredBranchPercentage());
if (system.getDiscoveredSecretCount() > 0) {
new ControlTextCentered(this, 155, system.getDiscoveredSecretCount() + '/' + system.getTotalSecretCount() + ' ' + I18N.localise(DatabaseConstants.BREEDER_KEY + ".species.secret"));
}
new ControlTextCentered(this, 32, this.player.getName());
new ControlTextCentered(this, 44, TextFormatting.ITALIC + system.getEpitome());
}
use of binnie.core.gui.controls.ControlTextCentered in project Binnie by ForestryMC.
the class AnalystManager method drawRefined.
@Override
@SideOnly(Side.CLIENT)
public int drawRefined(IWidget parent, String string, int y, Collection<ItemStack> products) {
new ControlTextCentered(parent, y, string).setColor(parent.getColor());
y += 10;
int maxBiomePerLine = (parent.getWidth() + 2 - 16) / 18;
int biomeListX = (parent.getWidth() - (Math.min(maxBiomePerLine, products.size()) * 18 - 2)) / 2;
int dx = 0;
int dy = 0;
for (ItemStack soilStack : products) {
if (dx >= 18 * maxBiomePerLine) {
dx = 0;
dy += 18;
}
FluidStack fluid = FluidUtil.getFluidContained(soilStack);
soilStack.setCount(1);
ControlItemDisplay display = new ControlItemDisplay(parent, biomeListX + dx, y + dy, soilStack, fluid == null);
if (fluid != null) {
display.addTooltip(fluid.getLocalizedName());
}
dx += 18;
}
if (dx != 0) {
dy += 18;
}
y += dy;
return y;
}
use of binnie.core.gui.controls.ControlTextCentered 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));
}
Aggregations