Fix tooltip

This commit is contained in:
drcrazy 2020-10-24 00:30:37 +03:00
parent 342917851b
commit ca24d58f86
12 changed files with 31 additions and 29 deletions

View file

@ -240,7 +240,7 @@ public class CableBlockEntity extends BlockEntity
new TranslatableText("techreborn.tooltip.transferRate")
.formatted(Formatting.GRAY)
.append(": ")
.append(PowerSystem.getLocaliszedPowerFormatted(getCableType().transferRate))
.append(PowerSystem.getLocalizedPower(getCableType().transferRate))
.formatted(Formatting.GOLD)
.append("/t")
);

View file

@ -226,7 +226,7 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
.formatted(Formatting.GRAY)
.append(": ")
.append(
new LiteralText(PowerSystem.getLocaliszedPowerFormatted(getMaxStoredPower()))
new LiteralText(PowerSystem.getLocalizedPower(getMaxStoredPower()))
.formatted(Formatting.GOLD)
)
);
@ -236,7 +236,7 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
.formatted(Formatting.GRAY)
.append(": ")
.append(
new LiteralText(PowerSystem.getLocaliszedPowerFormatted(panel.generationRateD))
new LiteralText(PowerSystem.getLocalizedPower(panel.generationRateD))
.formatted(Formatting.GOLD)
)
);
@ -246,7 +246,7 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
.formatted(Formatting.GRAY)
.append(": ")
.append(
new LiteralText(PowerSystem.getLocaliszedPowerFormatted(panel.generationRateN))
new LiteralText(PowerSystem.getLocalizedPower(panel.generationRateN))
.formatted(Formatting.GOLD)
)
);

View file

@ -141,12 +141,12 @@ public class TransformerBlockEntity extends PowerAcceptorBlockEntity implements
}
// IListInfoProvider
// TO-DO: translate
// TODO: translate
@Override
public void addInfo(List<Text> info, boolean isReal, boolean hasData) {
info.add(new LiteralText(Formatting.GRAY + "Input Rate: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxInput(EnergySide.UNKNOWN))));
info.add(new LiteralText(Formatting.GRAY + "Input Rate: " + Formatting.GOLD + PowerSystem.getLocalizedPower(getMaxInput(EnergySide.UNKNOWN))));
info.add(new LiteralText(Formatting.GRAY + "Input Tier: " + Formatting.GOLD + StringUtils.toFirstCapitalAllLowercase(inputTier.toString())));
info.add(new LiteralText(Formatting.GRAY + "Output Rate: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxOutput(EnergySide.UNKNOWN))));
info.add(new LiteralText(Formatting.GRAY + "Output Rate: " + Formatting.GOLD + PowerSystem.getLocalizedPower(getMaxOutput(EnergySide.UNKNOWN))));
info.add(new LiteralText(Formatting.GRAY + "Output Tier: " + Formatting.GOLD + StringUtils.toFirstCapitalAllLowercase(outputTier.toString())));
}
}

View file

@ -76,9 +76,9 @@ public class GuiAESU extends GuiBase<BuiltScreenHandler> {
if (!hideGuiElements()) {
RenderSystem.pushMatrix();
RenderSystem.scaled(0.6, 0.6, 1);
Text text = new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getEnergy()))
Text text = new LiteralText(PowerSystem.getLocalizedPowerNoSuffix((int) blockEntity.getEnergy()))
.append("/")
.append(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getMaxStoredPower()))
.append(PowerSystem.getLocalizedPowerNoSuffix((int) blockEntity.getMaxStoredPower()))
.append(" ")
.append(PowerSystem.getDisplayPower().abbreviation);

View file

@ -60,9 +60,9 @@ public class GuiBatbox extends GuiBase<BuiltScreenHandler> {
if (!hideGuiElements()) {
RenderSystem.pushMatrix();
RenderSystem.scaled(0.6, 0.6, 5);
Text text = new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getEnergy()))
Text text = new LiteralText(PowerSystem.getLocalizedPowerNoSuffix(blockEntity.getEnergy()))
.append("/")
.append(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getMaxStoredPower()))
.append(PowerSystem.getLocalizedPowerNoSuffix(blockEntity.getMaxStoredPower()))
.append(" ")
.append(PowerSystem.getDisplayPower().abbreviation);

View file

@ -89,7 +89,7 @@ public class GuiFusionReactor extends GuiBase<BuiltScreenHandler> {
addHologramButton(6, 4, 212, layer).clickHandler(this::hologramToggle);
drawCentredText(matrixStack, blockEntity.getStateText(), 20, Color.BLUE.darker().getColor(), layer);
if (blockEntity.state == 2) {
drawCentredText(matrixStack, new LiteralText(PowerSystem.getLocaliszedPowerFormatted((int) blockEntity.getPowerChange())).append("/t"), 30, Color.GREEN.darker().getColor(), layer);
drawCentredText(matrixStack, new LiteralText(PowerSystem.getLocalizedPower(blockEntity.getPowerChange())).append("/t"), 30, Color.GREEN.darker().getColor(), layer);
}
} else {
builder.drawMultiblockMissingBar(matrixStack, this, layer);

View file

@ -61,9 +61,9 @@ public class GuiIDSU extends GuiBase<BuiltScreenHandler> {
RenderSystem.pushMatrix();
RenderSystem.scaled(0.6, 0.6, 1);
Text text = new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) idsu.getEnergy()))
Text text = new LiteralText(PowerSystem.getLocalizedPowerNoSuffix(idsu.getEnergy()))
.append("/")
.append(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) idsu.getMaxStoredPower()))
.append(PowerSystem.getLocalizedPowerNoSuffix(idsu.getMaxStoredPower()))
.append(" ")
.append(PowerSystem.getDisplayPower().abbreviation);

View file

@ -24,7 +24,6 @@
package techreborn.client.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;
@ -57,12 +56,15 @@ public class GuiLESU extends GuiBase<BuiltScreenHandler> {
super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
RenderSystem.pushMatrix();
RenderSystem.scaled(0.6, 0.6, 1);
drawCentredText(matrixStack, new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getEnergy()) + "/"
+ PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getMaxStoredPower()) + " "
+ PowerSystem.getDisplayPower().abbreviation), 35, 0, 58, layer);
RenderSystem.popMatrix();
matrixStack.push();
matrixStack.scale(0.6f, 0.6f, 1.0f);
drawCentredText(matrixStack, new LiteralText(PowerSystem.getLocalizedPowerNoSuffix( blockEntity.getEnergy()))
.append("/")
.append(PowerSystem.getLocalizedPowerNoSuffix(blockEntity.getMaxStoredPower()))
.append(" ")
.append(PowerSystem.getDisplayPower().abbreviation),
35, 0, 58, layer);
matrixStack.pop();
builder.drawMultiEnergyBar(matrixStack, this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxStoredPower(), mouseX, mouseY, 0, layer);
}

View file

@ -61,9 +61,9 @@ public class GuiMFE extends GuiBase<BuiltScreenHandler> {
RenderSystem.pushMatrix();
RenderSystem.scaled(0.6, 0.6, 1);
drawCentredText(matrixStack, new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfe.getEnergy()))
drawCentredText(matrixStack, new LiteralText(PowerSystem.getLocalizedPowerNoSuffix(mfe.getEnergy()))
.append("/")
.append(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfe.getMaxStoredPower()))
.append(PowerSystem.getLocalizedPowerNoSuffix(mfe.getMaxStoredPower()))
.append(" ")
.append(PowerSystem.getDisplayPower().abbreviation)
, 35, 0, 58, layer);

View file

@ -59,7 +59,7 @@ public class GuiMFSU extends GuiBase<BuiltScreenHandler> {
RenderSystem.pushMatrix();
RenderSystem.scaled(0.6, 0.6, 1);
drawCentredText(matrixStack, new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfsu.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfsu.getMaxStoredPower()) + " " + PowerSystem.getDisplayPower().abbreviation), 35, 0, 58, layer);
drawCentredText(matrixStack, new LiteralText(PowerSystem.getLocalizedPowerNoSuffix(mfsu.getEnergy()) + "/" + PowerSystem.getLocalizedPowerNoSuffix(mfsu.getMaxStoredPower()) + " " + PowerSystem.getDisplayPower().abbreviation), 35, 0, 58, layer);
RenderSystem.popMatrix();
builder.drawMultiEnergyBar(matrixStack, this, 81, 28, (int) mfsu.getEnergy(), (int) mfsu.getMaxStoredPower(), mouseX, mouseY, 0, layer);

View file

@ -100,9 +100,9 @@ public class StackToolTipHandler implements ItemTooltipCallback {
if (item instanceof IListInfoProvider) {
((IListInfoProvider) item).addInfo(components, false, false);
} else if (stack.getItem() instanceof EnergyHolder) {
LiteralText line1 = new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix(Energy.of(stack).getEnergy()));
LiteralText line1 = new LiteralText(PowerSystem.getLocalizedPowerNoSuffix(Energy.of(stack).getEnergy()));
line1.append("/");
line1.append(PowerSystem.getLocaliszedPowerFormattedNoSuffix(Energy.of(stack).getMaxStored()));
line1.append(PowerSystem.getLocalizedPowerNoSuffix(Energy.of(stack).getMaxStored()));
line1.append(" ");
line1.append(PowerSystem.getDisplayPower().abbreviation);
line1.formatted(Formatting.GOLD);
@ -114,7 +114,7 @@ public class StackToolTipHandler implements ItemTooltipCallback {
Formatting color = StringUtils.getPercentageColour(percentage);
components.add(2, new LiteralText(color + "" + percentage + "%" + Formatting.GRAY + " Charged"));
// TODO: show both input and output rates
components.add(3, new LiteralText(Formatting.GRAY + "I/O Rate: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted(((EnergyHolder) item).getMaxInput(EnergySide.UNKNOWN))));
components.add(3, new LiteralText(Formatting.GRAY + "I/O Rate: " + Formatting.GOLD + PowerSystem.getLocalizedPower(((EnergyHolder) item).getMaxInput(EnergySide.UNKNOWN))));
}
} else {
try {

View file

@ -113,9 +113,9 @@ public class DebugToolItem extends Item {
String s = "" + Formatting.GREEN;
s += "Power: ";
s += Formatting.BLUE;
s += PowerSystem.getLocaliszedPower(Energy.of(blockEntity).getEnergy());
s += PowerSystem.getLocalizedPower(Energy.of(blockEntity).getEnergy());
s += "/";
s += PowerSystem.getLocaliszedPower(Energy.of(blockEntity).getMaxStored());
s += PowerSystem.getLocalizedPower(Energy.of(blockEntity).getMaxStored());
return s;
}