mirror of
https://github.com/GTNewHorizons/waila.git
synced 2026-11-16 18:45:05 +00:00
Compare commits
25
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
795e82f3a1 | ||
|
|
80982007b8 | ||
|
|
c1702ab75a | ||
|
|
7687cfae06 | ||
|
|
6ae4a8fb6e | ||
|
|
b3d5185618 | ||
|
|
4fb2924e2c | ||
|
|
7d2a9221a7 | ||
|
|
ebdc187f48 | ||
|
|
dee612202c | ||
|
|
6b6595aaec | ||
|
|
12fb4b20c8 | ||
|
|
147598567e | ||
|
|
c5352d399a | ||
|
|
66d9f79517 | ||
|
|
9b9726c364 | ||
|
|
35f35f5036 | ||
|
|
157399c11b | ||
|
|
604c4eb253 | ||
|
|
4098a2fcf4 | ||
|
|
15e40a94cd | ||
|
|
ca489363fa | ||
|
|
05b3488dc1 | ||
|
|
d07abeca64 | ||
|
|
a7fe79406f |
No files matched your search
+12
-12
@@ -1,23 +1,23 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
implementation('com.github.GTNewHorizons:NotEnoughItems:2.8.50-GTNH:dev')
|
||||
implementation('com.github.GTNewHorizons:NotEnoughItems:2.8.20-GTNH:dev')
|
||||
|
||||
shadowImplementation('au.com.bytecode:opencsv:2.4')
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.205:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.69:dev") { transitive = false }
|
||||
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:WAILAPlugins:0.7.2:dev") {
|
||||
runtimeOnly("com.github.GTNewHorizons:WAILAPlugins:0.7.0:dev") {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'waila'
|
||||
}
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:EnderCore:0.5.3:dev")
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:BuildCraft:7.1.48:dev")
|
||||
runtimeOnlyNonPublishable("curse.maven:cofh-lib-220333:2388748")
|
||||
runtimeOnlyNonPublishable("curse.maven:extrautils-225561:2264383")
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:OpenBlocks:1.12.4-GTNH:dev")
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Railcraft:9.17.12:dev")
|
||||
runtimeOnlyNonPublishable('curse.maven:thermal-foundation-222880:2388753')
|
||||
runtimeOnlyNonPublishable('curse.maven:thermal-expansion-69163:2388759')
|
||||
runtimeOnlyNonPublishable('curse.maven:thermal-dynamics-227443:2388756')
|
||||
runtimeOnly("com.github.GTNewHorizons:EnderCore:0.5.0:dev")
|
||||
runtimeOnly("com.github.GTNewHorizons:BuildCraft:7.1.31:dev")
|
||||
runtimeOnly("curse.maven:cofh-lib-220333:2388748")
|
||||
runtimeOnly("curse.maven:extrautils-225561:2264383")
|
||||
runtimeOnly("com.github.GTNewHorizons:OpenBlocks:1.12.3-GTNH:dev")
|
||||
runtimeOnly("com.github.GTNewHorizons:Railcraft:9.17.6:dev")
|
||||
runtimeOnly('curse.maven:thermal-foundation-222880:2388753')
|
||||
runtimeOnly('curse.maven:thermal-expansion-69163:2388759')
|
||||
runtimeOnly('curse.maven:thermal-dynamics-227443:2388756')
|
||||
implementation('curse.maven:cofh-core-69162:2388751')
|
||||
}
|
||||
@@ -79,10 +79,6 @@ public class TankFluidHandler implements IWailaDataProvider {
|
||||
}
|
||||
|
||||
private FluidTank getTank(TileEntity tileEntity) {
|
||||
if (tileEntity == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
Object tank = RailcraftModule.TileTankBase_getTank.invoke(tileEntity);
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.utils.NumberFormatter;
|
||||
|
||||
public class HUDHandlerEnergyCell implements IWailaDataProvider {
|
||||
|
||||
@@ -37,11 +36,11 @@ public class HUDHandlerEnergyCell implements IWailaDataProvider {
|
||||
|
||||
currenttip.add(
|
||||
String.format(
|
||||
"%s/%s : %s / %s RF/t",
|
||||
"%s/%s : %d / %d RF/t",
|
||||
LangUtil.translateG("hud.msg.in"),
|
||||
LangUtil.translateG("hud.msg.out"),
|
||||
NumberFormatter.format(energyReceive),
|
||||
NumberFormatter.format(energySend)));
|
||||
energyReceive,
|
||||
energySend));
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
+4
-3
@@ -1,5 +1,6 @@
|
||||
package mcp.mobius.waila.addons.thermalexpansion;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -14,7 +15,6 @@ import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.SpecialChars;
|
||||
import mcp.mobius.waila.utils.NumberFormatter;
|
||||
|
||||
public class HUDHandlerIEnergyHandler implements IWailaDataProvider {
|
||||
|
||||
@@ -48,10 +48,11 @@ public class HUDHandlerIEnergyHandler implements IWailaDataProvider {
|
||||
"RFEnergyStorage");
|
||||
} else {
|
||||
taggedTips.add(
|
||||
// TODO: Use NumberFormatter from #54
|
||||
String.format(
|
||||
"%s / %s RF",
|
||||
NumberFormatter.format(energy),
|
||||
NumberFormatter.format(maxEnergy)),
|
||||
NumberFormat.getInstance().format(energy),
|
||||
NumberFormat.getInstance().format(maxEnergy)),
|
||||
"RFEnergyStorage");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import net.minecraft.world.World;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.SpecialChars;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
public class HUDHandlerTesseract implements IWailaDataProvider {
|
||||
@@ -34,9 +33,9 @@ public class HUDHandlerTesseract implements IWailaDataProvider {
|
||||
if (config.getConfig("thermalexpansion.tesssendrecv")) {
|
||||
String send = String.format("%s : ", LangUtil.translateG("hud.msg.send"));
|
||||
String recv = String.format("%s : ", LangUtil.translateG("hud.msg.recv"));
|
||||
String item = String.format("%s ", SpecialChars.GREEN + LangUtil.translateG("hud.msg.item"));
|
||||
String fluid = String.format("%s ", SpecialChars.BLUE + LangUtil.translateG("hud.msg.fluid"));
|
||||
String energ = String.format("%s ", SpecialChars.RED + LangUtil.translateG("hud.msg.energ"));
|
||||
String item = String.format("\u00a7a%s ", LangUtil.translateG("hud.msg.item"));
|
||||
String fluid = String.format("\u00a79%s ", LangUtil.translateG("hud.msg.fluid"));
|
||||
String energ = String.format("\u00a7c%s ", LangUtil.translateG("hud.msg.energ"));
|
||||
|
||||
switch (accessor.getNBTInteger(accessor.getNBTData(), "Item.Mode")) {
|
||||
case 0:
|
||||
|
||||
@@ -32,11 +32,9 @@ public class TankFluidHandler implements IWailaDataProvider {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
TileEntity tileEntity = accessor.getTileEntity();
|
||||
if (tileEntity == null) return currenttip;
|
||||
|
||||
try {
|
||||
FluidStack fluid = (FluidStack) ThermalExpansionModule.TileTank_getTankFluid.invoke(tileEntity);
|
||||
FluidStack fluid = (FluidStack) ThermalExpansionModule.TileTank_getTankFluid
|
||||
.invoke(accessor.getTileEntity());
|
||||
String name = currenttip.get(0);
|
||||
String fluidName = fluid == null ? LangUtil.translateG("hud.msg.empty")
|
||||
: fluid.getFluid().getLocalizedName(fluid);
|
||||
@@ -44,7 +42,7 @@ public class TankFluidHandler implements IWailaDataProvider {
|
||||
currenttip.set(0, name + " < " + fluidName + " >");
|
||||
|
||||
} catch (Exception e) {
|
||||
WailaExceptionHandler.handleErr(e, tileEntity.getClass().getName(), currenttip);
|
||||
WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
@@ -58,12 +56,9 @@ public class TankFluidHandler implements IWailaDataProvider {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
TileEntity tileEntity = accessor.getTileEntity();
|
||||
if (tileEntity == null) return currenttip;
|
||||
|
||||
try {
|
||||
int amount = (Integer) ThermalExpansionModule.TileTank_getTankAmount.invoke(tileEntity);
|
||||
int capacity = (Integer) ThermalExpansionModule.TileTank_getTankCapacity.invoke(tileEntity);
|
||||
int amount = (Integer) ThermalExpansionModule.TileTank_getTankAmount.invoke(accessor.getTileEntity());
|
||||
int capacity = (Integer) ThermalExpansionModule.TileTank_getTankCapacity.invoke(accessor.getTileEntity());
|
||||
|
||||
currenttip.add(
|
||||
String.format(
|
||||
@@ -73,7 +68,7 @@ public class TankFluidHandler implements IWailaDataProvider {
|
||||
ConfigHandler.instance().fluidUnit));
|
||||
|
||||
} catch (Exception e) {
|
||||
WailaExceptionHandler.handleErr(e, tileEntity.getClass().getName(), currenttip);
|
||||
WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
|
||||
@@ -11,7 +11,6 @@ import net.minecraft.world.World;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.SpecialChars;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.utils.WailaExceptionHandler;
|
||||
|
||||
@@ -37,15 +36,17 @@ public class TankModeHandler implements IWailaDataProvider {
|
||||
if (mode == 0) {
|
||||
currenttip.add(
|
||||
String.format(
|
||||
"%s : %s",
|
||||
"%s : \u00a7a%s",
|
||||
LangUtil.translateG("hud.msg.mode"),
|
||||
SpecialChars.GREEN + LangUtil.translateG("hud.msg.input")));
|
||||
LangUtil.translateG("hud.msg.input")));
|
||||
} else if (mode == 1) {
|
||||
currenttip.add(
|
||||
String.format(
|
||||
"%s : %s",
|
||||
"%s : \u00a7c%s",
|
||||
LangUtil.translateG("hud.msg.mode"),
|
||||
SpecialChars.RED + LangUtil.translateG("hud.msg.output")));
|
||||
LangUtil.translateG("hud.msg.output")));
|
||||
} else {
|
||||
currenttip.add(String.format("Mode : Unknown (%d)", mode));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,15 +51,33 @@ public class TTRenderFluidBar implements IWailaVariableWidthTooltipRenderer {
|
||||
|
||||
@Override
|
||||
public Dimension getSize(String[] params, IWailaCommonAccessor accessor) {
|
||||
boolean isEmpty = (params[0].equals("EMPTYFLUID") && params[1].equals("EMPTYFLUID"));
|
||||
int displayWidth = DisplayUtil.getDisplayWidth(
|
||||
buildDisplayText(
|
||||
isEmpty ? 0 : Double.parseDouble(params[2]),
|
||||
Double.parseDouble(params[3]),
|
||||
params[1],
|
||||
isEmpty));
|
||||
String barText;
|
||||
if (!(params[0].equals("EMPTYFLUID") && params[1].equals("EMPTYFLUID"))) {
|
||||
int commaCount = (int) (Math.floor((params[2].length() - 1) / 3D)
|
||||
+ Math.floor((params[3].length() - 1) / 3D));
|
||||
// ",".repeat(commaCount) doesn't exist in java 8 so do this instead.
|
||||
StringBuilder sb = new StringBuilder(commaCount);
|
||||
for (int i = 0; i < commaCount; i++) {
|
||||
sb.append(",");
|
||||
}
|
||||
barText = String
|
||||
.format("%s / %s %s %s%s", params[2], params[3], ConfigHandler.instance().fluidUnit, params[1], sb);
|
||||
} else {
|
||||
int commaCount = (int) (Math.floor((params[3].length() - 1) / 3D));
|
||||
// ",".repeat(commaCount) doesn't exist in java 8 so do this instead.
|
||||
StringBuilder sb = new StringBuilder(commaCount);
|
||||
for (int i = 0; i < commaCount; i++) {
|
||||
sb.append(",");
|
||||
}
|
||||
barText = String.format(
|
||||
"%s / %s %s%s",
|
||||
LangUtil.translateG("hud.msg.empty2"),
|
||||
params[3],
|
||||
ConfigHandler.instance().fluidUnit,
|
||||
sb);
|
||||
}
|
||||
|
||||
return new Dimension(displayWidth + 4, height);
|
||||
return new Dimension(DisplayUtil.getDisplayWidth(barText) + 4, height);
|
||||
}
|
||||
|
||||
public static final ResourceLocation gradient = new ResourceLocation("waila", "textures/gradient.png");
|
||||
@@ -115,27 +133,30 @@ public class TTRenderFluidBar implements IWailaVariableWidthTooltipRenderer {
|
||||
|
||||
drawThickBeveledBox(0, 0, maxStringW, height, 1, 0xFF505050, 0xFF505050, -1);
|
||||
|
||||
DisplayUtil.drawString(
|
||||
buildDisplayText(amount, capacity, localizedName, isEmpty),
|
||||
2,
|
||||
2,
|
||||
isEmpty ? 0xFFDDDDDD : 0xFFFFFFFF,
|
||||
true);
|
||||
}
|
||||
|
||||
public String buildDisplayText(double amount, double capacity, String fluidName, boolean isEmpty) {
|
||||
return isEmpty
|
||||
? String.format(
|
||||
"%s / %s %s",
|
||||
LangUtil.translateG("hud.msg.empty"),
|
||||
NumberFormatter.format((int) capacity),
|
||||
ConfigHandler.instance().fluidUnit)
|
||||
: String.format(
|
||||
"%s / %s %s %s",
|
||||
NumberFormatter.format((int) amount),
|
||||
NumberFormatter.format((int) capacity),
|
||||
ConfigHandler.instance().fluidUnit,
|
||||
fluidName);
|
||||
if (!isEmpty) {
|
||||
DisplayUtil.drawString(
|
||||
String.format(
|
||||
"%s / %s %s %s",
|
||||
NumberFormatter.format((int) amount),
|
||||
NumberFormatter.format((int) capacity),
|
||||
ConfigHandler.instance().fluidUnit,
|
||||
localizedName),
|
||||
2,
|
||||
2,
|
||||
0xFFFFFFFF,
|
||||
true);
|
||||
} else {
|
||||
DisplayUtil.drawString(
|
||||
String.format(
|
||||
"%s / %s %s",
|
||||
LangUtil.translateG("hud.msg.empty"),
|
||||
NumberFormatter.format((int) capacity),
|
||||
ConfigHandler.instance().fluidUnit),
|
||||
2,
|
||||
2,
|
||||
0xFFDDDDDD,
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
public static void drawRectFromIcon(Tessellator tessellator, int x, int y, double z, IIcon icon, int width,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package mcp.mobius.waila.overlay.tooltiprenderers;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
@@ -12,20 +14,33 @@ import org.lwjgl.opengl.GL11;
|
||||
import mcp.mobius.waila.api.IWailaCommonAccessor;
|
||||
import mcp.mobius.waila.api.IWailaVariableWidthTooltipRenderer;
|
||||
import mcp.mobius.waila.overlay.DisplayUtil;
|
||||
import mcp.mobius.waila.utils.NumberFormatter;
|
||||
|
||||
public class TTRenderRFBar implements IWailaVariableWidthTooltipRenderer {
|
||||
|
||||
int maxStringW;
|
||||
|
||||
private final Function<Integer, String> formatNumber;
|
||||
private static final NumberFormat energyFormat = NumberFormat.getInstance();
|
||||
private static final int height = 12;
|
||||
private static final int width = 2;
|
||||
|
||||
static {
|
||||
energyFormat.setGroupingUsed(true);
|
||||
}
|
||||
|
||||
public TTRenderRFBar() {
|
||||
formatNumber = energyFormat::format;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getSize(String[] params, IWailaCommonAccessor accessor) {
|
||||
int commaCount = (int) (Math.floor((params[0].length() - 1) / 3D) + Math.floor((params[1].length() - 1) / 3D));
|
||||
StringBuilder sb = new StringBuilder(commaCount);
|
||||
for (int i = 0; i < commaCount; i++) {
|
||||
sb.append(",");
|
||||
}
|
||||
return new Dimension(
|
||||
DisplayUtil.getDisplayWidth(buildDisplayText(Integer.parseInt(params[0]), Integer.parseInt(params[1])))
|
||||
+ 4,
|
||||
DisplayUtil.getDisplayWidth(String.format("%s / %s RF%s", params[0], params[1], sb)) + 4,
|
||||
height);
|
||||
}
|
||||
|
||||
@@ -70,11 +85,13 @@ public class TTRenderRFBar implements IWailaVariableWidthTooltipRenderer {
|
||||
drawRect(tessellator, 1, 1, 0, maxStringW - 2, height - 2, 0, 0, 1, 1);
|
||||
tessellator.draw();
|
||||
|
||||
DisplayUtil.drawString(buildDisplayText(amount, capacity), 2, 2, 0xFFFFFFFF, true);
|
||||
}
|
||||
DisplayUtil.drawString(
|
||||
String.format("%s / %s RF", formatNumber.apply(amount), formatNumber.apply(capacity)),
|
||||
2,
|
||||
2,
|
||||
0xFFFFFFFF,
|
||||
true);
|
||||
|
||||
public String buildDisplayText(int amount, int capacity) {
|
||||
return String.format("%s / %s RF", NumberFormatter.format(amount), NumberFormatter.format(capacity));
|
||||
}
|
||||
|
||||
public static void drawRect(Tessellator tessellator, int x, int y, double z, int width, int height, double minU,
|
||||
|
||||
@@ -7,21 +7,15 @@ import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import mcp.mobius.waila.api.IWailaCommonAccessor;
|
||||
import mcp.mobius.waila.api.IWailaTooltipRenderer;
|
||||
import mcp.mobius.waila.api.SpecialChars;
|
||||
import mcp.mobius.waila.overlay.DisplayUtil;
|
||||
|
||||
public class TTRenderStack implements IWailaTooltipRenderer {
|
||||
|
||||
@Override
|
||||
public Dimension getSize(String[] params, IWailaCommonAccessor accessor) {
|
||||
boolean small = Boolean.parseBoolean(params.length > 4 ? params[4] : "false");
|
||||
return small ? new Dimension(10, 8) : new Dimension(16, 16);
|
||||
return new Dimension(16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -30,43 +24,14 @@ public class TTRenderStack implements IWailaTooltipRenderer {
|
||||
String name = params[1]; // Fully qualified name
|
||||
int amount = Integer.parseInt(params[2]);
|
||||
int meta = Integer.parseInt(params[3]);
|
||||
boolean small = Boolean.parseBoolean(params.length > 4 ? params[4] : "false");
|
||||
final float scale = 0.5f;
|
||||
|
||||
ItemStack stack = null;
|
||||
if (type == 0) stack = new ItemStack((Block) Block.blockRegistry.getObject(name), amount, meta);
|
||||
if (type == 1) stack = new ItemStack((Item) Item.itemRegistry.getObject(name), amount, meta);
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
|
||||
if (small) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glScaled(scale, scale, 1.0f);
|
||||
|
||||
DisplayUtil.renderStack(0, 0, stack);
|
||||
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
} else {
|
||||
DisplayUtil.renderStack(0, 0, stack);
|
||||
}
|
||||
DisplayUtil.renderStack(0, 0, stack);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
}
|
||||
|
||||
public static String create(ItemStack itemStack, int amount, boolean small) {
|
||||
String name = GameData.getItemRegistry().getNameForObject(itemStack.getItem());
|
||||
int meta = itemStack.getItemDamage();
|
||||
return SpecialChars.getRenderString(
|
||||
"waila.stack",
|
||||
String.valueOf(1),
|
||||
name,
|
||||
String.valueOf(amount),
|
||||
String.valueOf(meta),
|
||||
String.valueOf(small));
|
||||
}
|
||||
|
||||
public static String create(ItemStack itemStack, boolean small) {
|
||||
return create(itemStack, 1, small);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user