mirror of
https://github.com/GTNewHorizons/waila.git
synced 2026-11-16 18:45:05 +00:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
677a74dad7 | ||
|
|
10219fd204 | ||
|
|
d14044c92e | ||
|
|
5c115d9af3 |
No files matched your search
+12
-12
@@ -1,23 +1,23 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
implementation('com.github.GTNewHorizons:NotEnoughItems:2.8.37-GTNH:dev')
|
||||
implementation('com.github.GTNewHorizons:NotEnoughItems:2.8.50-GTNH:dev')
|
||||
|
||||
shadowImplementation('au.com.bytecode:opencsv:2.4')
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.111:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.205:dev") { transitive = false }
|
||||
|
||||
runtimeOnly("com.github.GTNewHorizons:WAILAPlugins:0.7.0:dev") {
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:WAILAPlugins:0.7.2:dev") {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'waila'
|
||||
}
|
||||
runtimeOnly("com.github.GTNewHorizons:EnderCore:0.5.0:dev")
|
||||
runtimeOnly("com.github.GTNewHorizons:BuildCraft:7.1.45: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')
|
||||
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')
|
||||
implementation('curse.maven:cofh-core-69162:2388751')
|
||||
}
|
||||
@@ -174,12 +174,6 @@ curseForgeRelations =
|
||||
# projects. New projects should not use this parameter.
|
||||
# customArchiveBaseName =
|
||||
|
||||
# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory.
|
||||
# runClientWorkingDirectory = run/client
|
||||
|
||||
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory.
|
||||
# runServerWorkingDirectory = run/server
|
||||
|
||||
# Optional parameter to have the build automatically fail if an illegal version is used.
|
||||
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
|
||||
# The check is ONLY performed if the version is a git tag.
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -114,7 +114,7 @@ case "$( uname )" in #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH="\\\"\\\""
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@@ -213,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
|
||||
Vendored
+2
-2
@@ -70,11 +70,11 @@ goto fail
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.48'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.46'
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ 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 {
|
||||
|
||||
@@ -36,11 +37,11 @@ public class HUDHandlerEnergyCell implements IWailaDataProvider {
|
||||
|
||||
currenttip.add(
|
||||
String.format(
|
||||
"%s/%s : %d / %d RF/t",
|
||||
"%s/%s : %s / %s RF/t",
|
||||
LangUtil.translateG("hud.msg.in"),
|
||||
LangUtil.translateG("hud.msg.out"),
|
||||
energyReceive,
|
||||
energySend));
|
||||
NumberFormatter.format(energyReceive),
|
||||
NumberFormatter.format(energySend)));
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
+3
-4
@@ -1,6 +1,5 @@
|
||||
package mcp.mobius.waila.addons.thermalexpansion;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -15,6 +14,7 @@ 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,11 +48,10 @@ public class HUDHandlerIEnergyHandler implements IWailaDataProvider {
|
||||
"RFEnergyStorage");
|
||||
} else {
|
||||
taggedTips.add(
|
||||
// TODO: Use NumberFormatter from #54
|
||||
String.format(
|
||||
"%s / %s RF",
|
||||
NumberFormat.getInstance().format(energy),
|
||||
NumberFormat.getInstance().format(maxEnergy)),
|
||||
NumberFormatter.format(energy),
|
||||
NumberFormatter.format(maxEnergy)),
|
||||
"RFEnergyStorage");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ 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 {
|
||||
@@ -33,9 +34,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("\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"));
|
||||
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"));
|
||||
|
||||
switch (accessor.getNBTInteger(accessor.getNBTData(), "Item.Mode")) {
|
||||
case 0:
|
||||
|
||||
@@ -51,33 +51,15 @@ public class TTRenderFluidBar implements IWailaVariableWidthTooltipRenderer {
|
||||
|
||||
@Override
|
||||
public Dimension getSize(String[] params, IWailaCommonAccessor accessor) {
|
||||
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.empty"),
|
||||
params[3],
|
||||
ConfigHandler.instance().fluidUnit,
|
||||
sb);
|
||||
}
|
||||
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));
|
||||
|
||||
return new Dimension(DisplayUtil.getDisplayWidth(barText) + 4, height);
|
||||
return new Dimension(displayWidth + 4, height);
|
||||
}
|
||||
|
||||
public static final ResourceLocation gradient = new ResourceLocation("waila", "textures/gradient.png");
|
||||
@@ -133,30 +115,27 @@ public class TTRenderFluidBar implements IWailaVariableWidthTooltipRenderer {
|
||||
|
||||
drawThickBeveledBox(0, 0, maxStringW, height, 1, 0xFF505050, 0xFF505050, -1);
|
||||
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
public static void drawRectFromIcon(Tessellator tessellator, int x, int y, double z, IIcon icon, int width,
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
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;
|
||||
@@ -14,33 +12,20 @@ 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(String.format("%s / %s RF%s", params[0], params[1], sb)) + 4,
|
||||
DisplayUtil.getDisplayWidth(buildDisplayText(Integer.parseInt(params[0]), Integer.parseInt(params[1])))
|
||||
+ 4,
|
||||
height);
|
||||
}
|
||||
|
||||
@@ -85,13 +70,11 @@ public class TTRenderRFBar implements IWailaVariableWidthTooltipRenderer {
|
||||
drawRect(tessellator, 1, 1, 0, maxStringW - 2, height - 2, 0, 0, 1, 1);
|
||||
tessellator.draw();
|
||||
|
||||
DisplayUtil.drawString(
|
||||
String.format("%s / %s RF", formatNumber.apply(amount), formatNumber.apply(capacity)),
|
||||
2,
|
||||
2,
|
||||
0xFFFFFFFF,
|
||||
true);
|
||||
DisplayUtil.drawString(buildDisplayText(amount, 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,15 +7,21 @@ 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) {
|
||||
return new Dimension(16, 16);
|
||||
boolean small = Boolean.parseBoolean(params.length > 4 ? params[4] : "false");
|
||||
return small ? new Dimension(10, 8) : new Dimension(16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -24,14 +30,43 @@ 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();
|
||||
DisplayUtil.renderStack(0, 0, stack);
|
||||
|
||||
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);
|
||||
}
|
||||
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