Compare commits

..
2 Commits
Author SHA1 Message Date
danyadev 5c115d9af3 WailaPlugins compat (#54) 2025-11-15 18:17:38 +01:00
danyadev c0a119902a add a note about forking the repo in README.md (#52) 2025-11-15 09:50:17 +00:00
12 changed files with 79 additions and 123 deletions

No files matched your search

+2 -7
View File
@@ -1,14 +1,9 @@
// Add your dependencies here
dependencies {
implementation('com.github.GTNewHorizons:NotEnoughItems:2.8.37-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.106:dev") { transitive = false }
// For testing addon integration
runtimeOnly("com.github.GTNewHorizons:WAILAPlugins:0.7.0:dev") { transitive = false }
runtimeOnly("com.github.GTNewHorizons:EnderCore:0.5.0:dev") { transitive = false }
runtimeOnly("com.mod-buildcraft:buildcraft:7.1.23:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.69:dev") { transitive = false }
}
-6
View File
@@ -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.
Binary file not shown.
+1 -1
View File
@@ -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
Vendored
+2 -2
View File
@@ -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
View File
@@ -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
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.48'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.46'
}
@@ -79,6 +79,10 @@ public class TankFluidHandler implements IWailaDataProvider {
}
private FluidTank getTank(TileEntity tileEntity) {
if (tileEntity == null) {
return null;
}
try {
Object tank = RailcraftModule.TileTankBase_getTank.invoke(tileEntity);
@@ -32,9 +32,11 @@ public class TankFluidHandler implements IWailaDataProvider {
return currenttip;
}
TileEntity tileEntity = accessor.getTileEntity();
if (tileEntity == null) return currenttip;
try {
FluidStack fluid = (FluidStack) ThermalExpansionModule.TileTank_getTankFluid
.invoke(accessor.getTileEntity());
FluidStack fluid = (FluidStack) ThermalExpansionModule.TileTank_getTankFluid.invoke(tileEntity);
String name = currenttip.get(0);
String fluidName = fluid == null ? LangUtil.translateG("hud.msg.empty")
: fluid.getFluid().getLocalizedName(fluid);
@@ -42,7 +44,7 @@ public class TankFluidHandler implements IWailaDataProvider {
currenttip.set(0, name + " < " + fluidName + " >");
} catch (Exception e) {
WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
WailaExceptionHandler.handleErr(e, tileEntity.getClass().getName(), currenttip);
}
return currenttip;
@@ -56,9 +58,12 @@ public class TankFluidHandler implements IWailaDataProvider {
return currenttip;
}
TileEntity tileEntity = accessor.getTileEntity();
if (tileEntity == null) return currenttip;
try {
int amount = (Integer) ThermalExpansionModule.TileTank_getTankAmount.invoke(accessor.getTileEntity());
int capacity = (Integer) ThermalExpansionModule.TileTank_getTankCapacity.invoke(accessor.getTileEntity());
int amount = (Integer) ThermalExpansionModule.TileTank_getTankAmount.invoke(tileEntity);
int capacity = (Integer) ThermalExpansionModule.TileTank_getTankCapacity.invoke(tileEntity);
currenttip.add(
String.format(
@@ -68,7 +73,7 @@ public class TankFluidHandler implements IWailaDataProvider {
ConfigHandler.instance().fluidUnit));
} catch (Exception e) {
WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
WailaExceptionHandler.handleErr(e, tileEntity.getClass().getName(), currenttip);
}
return currenttip;
@@ -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;
import mcp.mobius.waila.utils.WailaExceptionHandler;
@@ -36,17 +37,15 @@ public class TankModeHandler implements IWailaDataProvider {
if (mode == 0) {
currenttip.add(
String.format(
"%s : \u00a7a%s",
"%s : %s",
LangUtil.translateG("hud.msg.mode"),
LangUtil.translateG("hud.msg.input")));
SpecialChars.GREEN + LangUtil.translateG("hud.msg.input")));
} else if (mode == 1) {
currenttip.add(
String.format(
"%s : \u00a7c%s",
"%s : %s",
LangUtil.translateG("hud.msg.mode"),
LangUtil.translateG("hud.msg.output")));
} else {
currenttip.add(String.format("Mode : Unknown (%d)", mode));
SpecialChars.RED + LangUtil.translateG("hud.msg.output")));
}
}
@@ -21,7 +21,6 @@ import gtPlusPlus.core.util.minecraft.FluidUtils;
import mcp.mobius.waila.api.IWailaCommonAccessor;
import mcp.mobius.waila.api.IWailaVariableWidthTooltipRenderer;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.cbcore.LangUtil;
import mcp.mobius.waila.overlay.DisplayUtil;
import mcp.mobius.waila.utils.LoadedMods;
import mcp.mobius.waila.utils.NumberFormatter;
@@ -51,33 +50,16 @@ 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.empty2"),
params[3],
ConfigHandler.instance().fluidUnit,
sb);
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(",");
}
return new Dimension(DisplayUtil.getDisplayWidth(barText) + 4, height);
return new Dimension(
DisplayUtil.getDisplayWidth(
params[2] + " / " + params[3] + ConfigHandler.instance().fluidUnit + params[1] + sb) + 4,
height);
}
public static final ResourceLocation gradient = new ResourceLocation("waila", "textures/gradient.png");
@@ -89,74 +71,56 @@ public class TTRenderFluidBar implements IWailaVariableWidthTooltipRenderer {
double amount = Double.parseDouble(params[2]);
double capacity = Double.parseDouble(params[3]);
Tessellator tessellator = Tessellator.instance;
boolean isEmpty = fluidName.equals("EMPTYFLUID") && localizedName.equals("EMPTYFLUID");
IIcon icon = FluidRegistry.getFluid(fluidName).getIcon();
Minecraft mc = Minecraft.getMinecraft();
if (!isEmpty) {
IIcon icon = FluidRegistry.getFluid(fluidName).getIcon();
mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
bindColor.accept(fluidName);
mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
tessellator.startDrawingQuads();
// Intentionally draw 2 pixels taller than needed than cover with the border to make the texture more
// visible
int i = (int) ((double) (maxStringW - 2) * amount / capacity);
int j = 0;
for (; i > height; i = i - height) {
drawRectFromIcon(tessellator, 1 + (j * height), 0, 0, icon, height, height);
j++;
}
if (i > 0) drawRect(
tessellator,
1 + (j * height),
0,
0,
i,
height,
icon.getMinU(),
icon.getMinV(),
icon.getMinU() + ((icon.getMaxU() - icon.getMinU()) * ((double) i / height)),
icon.getMaxV());
tessellator.draw();
}
bindColor.accept(fluidName);
if (!isEmpty) {
GL11.glEnable(GL11.GL_BLEND);
GL11.glColor4f(1F, 1F, 1F, 0.70F);
mc.getTextureManager().bindTexture(gradient);
tessellator.startDrawingQuads();
drawRect(tessellator, 1, 0, 0, maxStringW - 2, height - 1, 0, 0, 1, 1);
tessellator.draw();
} else {
Gui.drawRect(1, 0, maxStringW - 1, height - 1, 0x1A575656);
tessellator.startDrawingQuads();
// Intentionally draw 2 pixels taller than needed than cover with the border to make the texture more visible
int i = (int) ((double) (maxStringW - 2) * amount / capacity);
int j = 0;
for (; i > height; i = i - height) {
drawRectFromIcon(tessellator, 1 + (j * height), 0, 0, icon, height, height);
j++;
}
if (i > 0) drawRect(
tessellator,
1 + (j * height),
0,
0,
i,
height,
icon.getMinU(),
icon.getMinV(),
icon.getMinU() + ((icon.getMaxU() - icon.getMinU()) * ((double) i / height)),
icon.getMaxV());
tessellator.draw();
GL11.glEnable(GL11.GL_BLEND);
GL11.glColor4f(1F, 1F, 1F, 0.70F);
mc.getTextureManager().bindTexture(gradient);
tessellator.startDrawingQuads();
drawRect(tessellator, 1, 0, 0, maxStringW - 2, height - 1, 0, 0, 1, 1);
tessellator.draw();
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(
NumberFormatter.format((int) amount) + " / "
+ NumberFormatter.format((int) capacity)
+ " "
+ ConfigHandler.instance().fluidUnit
+ " "
+ localizedName,
2,
2,
0xFFFFFFFF,
true);
}
public static void drawRectFromIcon(Tessellator tessellator, int x, int y, double z, IIcon icon, int width,
@@ -11,10 +11,6 @@ public class NumberFormatter {
private static NumberFormat numberFormat = NumberFormat.getInstance(getCurrentLocale());
static {
numberFormat.setGroupingUsed(true);
}
public static String format(long number) {
if (LoadedMods.GT5U) {
return GTUtility.formatNumbers(number);
@@ -34,6 +30,5 @@ public class NumberFormatter {
public static void onResourcesReload() {
numberFormat = NumberFormat.getInstance(getCurrentLocale());
numberFormat.setGroupingUsed(true);
}
}