Compare commits

..
3 Commits
Author SHA1 Message Date
Martin Robertz 1071a6e611 update 2.8.1 deps 2025-10-19 21:09:42 +02:00
acf75bf118 Draw thaumcraft aspect icons in tooltip (#41)
Co-authored-by: Super <[email protected]>
Co-authored-by: Martin Robertz <[email protected]>
2025-10-19 18:44:59 +02:00
EmperorSuper 8594e628f4 Add Gadomancy support (Thaumic Sight enchant) (#40) 2025-10-19 18:44:50 +02:00
12 changed files with 12 additions and 219 deletions

No files matched your search

+1 -3
View File
@@ -1,9 +1,7 @@
// Add your dependencies here
dependencies {
implementation('com.github.GTNewHorizons:NotEnoughItems:2.8.20-GTNH:dev')
implementation('com.github.GTNewHorizons:NotEnoughItems:2.7.91-GTNH:dev')
shadowImplementation('au.com.bytecode:opencsv:2.4')
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.69:dev") { transitive = false }
}
+1 -3
View File
@@ -96,9 +96,7 @@ usesMixinDebug = false
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin =
# Specify the package that contains all of your Mixins. The package must exist or
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
# it must match with this or the build will fail.
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.46'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.44'
}
@@ -1,29 +0,0 @@
package mcp.mobius.waila.api;
/**
* Interface for tooltip renderers that adjust their width depending on the width of the rest of the tooltip.
* setMaxLineWidth is called by {@link mcp.mobius.waila.overlay.Tooltip} before every tooltip render to inform the
* renderer of the width of the longest line in the tooltip.
*/
public interface IWailaVariableWidthTooltipRenderer extends IWailaTooltipRenderer {
/**
* Informs the renderer of what the length of the longest line is.</br>
* Called by {@link mcp.mobius.waila.overlay.Tooltip} before every tooltip render.</br>
*
* @param width The width of the longest line in the tooltip.
*
*/
void setMaxLineWidth(int width);
/**
* Returns the width of the longest line in the current tooltip.</br>
* With icons disabled the tooltip's background box is always 2 pixels wider to the right of the line than it is to
* the left.</br>
*
* @return The width of the longest line in the tooltip
*
*/
int getMaxLineWidth();
}
@@ -33,7 +33,6 @@ public class SpecialChars {
public static String WailaStyle = "\u00A4";
public static String WailaIcon = "\u00A5";
public static String WailaRenderer = "\u00A6";
public static String WailaRendererComma = "\u0082";
public static String TAB = WailaStyle + WailaStyle + "a";
public static String ALIGNRIGHT = WailaStyle + WailaStyle + "b";
public static String ALIGNCENTER = WailaStyle + WailaStyle + "c";
@@ -44,19 +43,12 @@ public class SpecialChars {
public static final Pattern patternMinecraft = Pattern.compile("(?i)" + MCStyle + "[0-9A-FK-OR]");
public static final Pattern patternWaila = Pattern.compile("(?i)(" + WailaStyle + "(?<type>..))");
// (?i)(¤¦a\{(?<name>[^U+0082}]*)U+0082?(?<args>[^}]*)\})
public static final Pattern patternRender = Pattern.compile(
"(?i)(" + RENDER
+ "\\{(?<name>[^"
+ WailaRendererComma
+ "}]*)"
+ WailaRendererComma
+ "?(?<args>[^}]*)\\})");
public static final Pattern patternRender = Pattern
.compile("(?i)(" + RENDER + "\\{(?<name>[^,}]*),?(?<args>[^}]*)\\})");
public static final Pattern patternTab = Pattern.compile("(?i)" + TAB);
public static final Pattern patternRight = Pattern.compile("(?i)" + ALIGNRIGHT);
public static final Pattern patternCenter = Pattern.compile("(?i)" + ALIGNCENTER);
public static final Pattern patternIcon = Pattern.compile("(?i)(" + WailaStyle + WailaIcon + "(?<type>[0-9a-z]))");
// (?i)(¤¤[^¤]+|¤¥[0-9A-Z]|¤¦a\{(?<name>[^U+0082}]*)U+0082?(?<args>[^}]*)\}|[^¤]+)
public static final Pattern patternLineSplit = Pattern.compile(
"(?i)(" + WailaStyle
+ WailaStyle
@@ -68,11 +60,7 @@ public class SpecialChars {
+ "[0-9A-Z]|"
+ WailaStyle
+ WailaRenderer
+ "a\\{(?<name>[^"
+ WailaRendererComma
+ "}]*)"
+ WailaRendererComma
+ "?(?<args>[^}]*)\\}|[^"
+ "a\\{([^,}]*),?([^}]*)\\}|[^"
+ WailaStyle
+ "]+)");
@@ -83,7 +71,7 @@ public class SpecialChars {
public static String getRenderString(String name, String... params) {
StringBuilder result = new StringBuilder(RENDER + "{" + name);
for (String s : params) {
result.append(WailaRendererComma).append(s);
result.append(",").append(s);
}
result.append("}");
return result.toString();
@@ -34,8 +34,6 @@ public class ConfigHandler implements IWailaConfigHandler {
public HashMap<String, Boolean> forcedConfigs = new HashMap<>();
public Configuration config = null;
public String fluidUnit;
public void addModule(String modName, HashMap<String, String> options) {
this.addModule(modName, new ConfigModule(modName, options));
}
@@ -152,7 +150,6 @@ public class ConfigHandler implements IWailaConfigHandler {
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_KEYBIND, true);
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_NEWFILTERS, true);
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOWICON, true);
fluidUnit = config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_FLUIDUNIT, "mB").getString();
OverlayConfig.posX = config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_POSX, 5000).getInt();
OverlayConfig.posY = config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_POSY, 100).getInt();
@@ -18,7 +18,6 @@ import mcp.mobius.waila.handlers.HUDHandlerEntities;
import mcp.mobius.waila.handlers.VanillaTooltipHandler;
import mcp.mobius.waila.handlers.nei.NEIHandler;
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderAspectString;
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderFluidBar;
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderHealth;
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderProgressBar;
import mcp.mobius.waila.overlay.tooltiprenderers.TTRenderStack;
@@ -55,7 +54,6 @@ public class ProxyClient extends ProxyServer {
ModuleRegistrar.instance().registerTooltipRenderer("waila.health", new TTRenderHealth());
ModuleRegistrar.instance().registerTooltipRenderer("waila.stack", new TTRenderStack());
ModuleRegistrar.instance().registerTooltipRenderer("waila.progress", new TTRenderProgressBar());
ModuleRegistrar.instance().registerTooltipRenderer("waila.fluid", new TTRenderFluidBar());
ModuleRegistrar.instance().registerTooltipRenderer("waila.tcaspect", new TTRenderAspectString());
@@ -2,6 +2,7 @@ package mcp.mobius.waila.handlers;
import static mcp.mobius.waila.api.SpecialChars.BLUE;
import static mcp.mobius.waila.api.SpecialChars.ITALIC;
import static mcp.mobius.waila.api.SpecialChars.RENDER;
import java.util.List;
@@ -71,7 +72,7 @@ public class HUDHandlerBlocks implements IWailaDataProvider {
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
// currenttip.add(RENDER + "{Plip}" + RENDER + "{Plop,thisisatest,222,333}");
currenttip.add(RENDER + "{Plip}" + RENDER + "{Plop,thisisatest,222,333}");
String modName = ModIdentification.nameFromStack(itemStack);
if (modName != null && !modName.isEmpty()) {
@@ -23,7 +23,6 @@ import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import mcp.mobius.waila.api.IWailaTooltipRenderer;
import mcp.mobius.waila.api.SpecialChars;
import mcp.mobius.waila.api.impl.DataAccessorCommon;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.utils.WailaExceptionHandler;
@@ -42,9 +41,8 @@ public class DisplayUtil {
Matcher renderMatcher = patternRender.matcher(s);
while (renderMatcher.find()) {
IWailaTooltipRenderer renderer = ModuleRegistrar.instance().getTooltipRenderer(renderMatcher.group("name"));
if (renderer != null) width += renderer.getSize(
renderMatcher.group("args").split(SpecialChars.WailaRendererComma),
DataAccessorCommon.instance).width;
if (renderer != null)
width += renderer.getSize(renderMatcher.group("args").split(","), DataAccessorCommon.instance).width;
}
Matcher iconMatcher = patternIcon.matcher(s);
@@ -21,8 +21,6 @@ import org.lwjgl.opengl.GL11;
import mcp.mobius.waila.api.IWailaCommonAccessor;
import mcp.mobius.waila.api.IWailaTooltipRenderer;
import mcp.mobius.waila.api.IWailaVariableWidthTooltipRenderer;
import mcp.mobius.waila.api.SpecialChars;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.api.impl.DataAccessorCommon;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
@@ -182,10 +180,7 @@ public class Tooltip {
renderable = new Renderable(
renderer,
new Point(offsetX, offsetY),
renderMatcher.group("args").split(SpecialChars.WailaRendererComma));
if (renderer instanceof IWailaVariableWidthTooltipRenderer variableWidthRenderer) {
variableWidthRenderer.setMaxLineWidth(maxStringW);
}
renderMatcher.group("args").split(","));
this.elements2nd.add(renderable);
}
} else if (iconMatcher.find()) {
@@ -1,150 +0,0 @@
package mcp.mobius.waila.overlay.tooltiprenderers;
import java.awt.Dimension;
import java.util.function.Consumer;
import java.util.function.Function;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.IIcon;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.common.Loader;
import gregtech.api.util.GTUtil;
import gregtech.api.util.GTUtility;
import gregtech.common.fluid.GTFluid;
import gtPlusPlus.api.objects.minecraft.FluidGT6;
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.overlay.DisplayUtil;
import mcp.mobius.waila.overlay.OverlayConfig;
public class TTRenderFluidBar implements IWailaVariableWidthTooltipRenderer {
int maxStringW;
private final Consumer<String> bindColor;
private final Function<Integer, String> formatNumber;
public TTRenderFluidBar() {
if (Loader.isModLoaded("gregtech")) {
bindColor = (fluidName) -> {
FluidStack aCheck = FluidUtils.getWildcardFluidStack(fluidName, 1000);
if (aCheck != null && (aCheck.getFluid() instanceof FluidGT6 || aCheck.getFluid() instanceof GTFluid)) {
short[] RGBa = GTUtil.getRGBaArray(aCheck.getFluid().getColor());
GL11.glColor4f(RGBa[0] / 255F, RGBa[1] / 255F, RGBa[2] / 255F, 1F);
} else {
GL11.glColor4f(1F, 1F, 1F, 1F);
}
};
formatNumber = GTUtility::formatNumbers;
} else {
bindColor = (fluidName) -> GL11.glColor4f(1F, 1F, 1F, 1F);
formatNumber = (number) -> String.format("%,d", number);
}
}
@Override
public Dimension getSize(String[] params, IWailaCommonAccessor accessor) {
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(
params[2] + " / " + params[3] + ConfigHandler.instance().fluidUnit + params[1] + sb) + 4,
12);
}
@Override
public void draw(String[] params, IWailaCommonAccessor accessor) {
String fluidName = params[0];
String localizedName = params[1];
double amount = Double.parseDouble(params[2]);
double capacity = Double.parseDouble(params[3]);
drawThickBeveledBox(0, 0, maxStringW, 12, 1, 0xFF505050, 0xFF505050, -1);
IIcon icon = FluidRegistry.getFluid(fluidName).getIcon();
Minecraft mc = Minecraft.getMinecraft();
mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
bindColor.accept(fluidName);
int i = (int) ((double) (maxStringW - 2) * amount / capacity);
int j = 0;
for (; i > 10; i = i - 10) {
drawTexturedModelRectFromIcon(1 + (j * 10), 1, icon, 10, 10, 100);
j++;
}
if (i > 0) drawTexturedModelRectFromIcon(
1 + (j * 10),
1,
icon,
i,
10,
100,
icon.getMinU() + ((icon.getMaxU() - icon.getMinU()) * ((double) i / 10D)),
icon.getMaxV());
DisplayUtil.drawString(
formatNumber.apply((int) amount) + " / "
+ formatNumber.apply((int) capacity)
+ " "
+ ConfigHandler.instance().fluidUnit
+ " "
+ localizedName,
2,
2,
OverlayConfig.fontcolor,
true);
}
public static void drawTexturedModelRectFromIcon(int x, int y, IIcon icon, int width, int height, double z) {
drawTexturedModelRectFromIcon(x, y, icon, width, height, z, icon.getMaxU(), icon.getMaxV());
}
public static void drawTexturedModelRectFromIcon(int x, int y, IIcon icon, int width, int height, double z,
double maxU, double maxV) {
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(x, y + height, z, icon.getMinU(), maxV);
tessellator.addVertexWithUV(x + width, y + height, z, maxU, maxV);
tessellator.addVertexWithUV(x + width, y, z, maxU, icon.getMinV());
tessellator.addVertexWithUV(x, y, z, icon.getMinU(), icon.getMinV());
tessellator.draw();
}
public static void drawThickBeveledBox(int x1, int y1, int x2, int y2, int thickness, int topleftcolor,
int botrightcolor, int fillcolor) {
if (fillcolor != -1) {
Gui.drawRect(x1 + 1, y1 + 1, x2 - 1, y2 - 1, fillcolor);
}
Gui.drawRect(x1, y1, x2 - 1, y1 + thickness, topleftcolor);
Gui.drawRect(x1, y1, x1 + thickness, y2 - 1, topleftcolor);
Gui.drawRect(x2 - thickness, y1, x2, y2 - 1, botrightcolor);
Gui.drawRect(x1, y2 - thickness, x2, y2, botrightcolor);
}
@Override
public void setMaxLineWidth(int width) {
maxStringW = width + 2;
}
@Override
public int getMaxLineWidth() {
return maxStringW;
}
}
@@ -29,7 +29,6 @@ public final class Constants {
public static String CFG_WAILA_NHEARTS = "waila.cfg.heartsperline";
public static String CFG_WAILA_MAXHP = "waila.cfg.maxhpbeforetext";
public static String CFG_WAILA_NEWFILTERS = "waila.cfg.newfilters";
public static String CFG_WAILA_FLUIDUNIT = "waila.cfg.fluid_unit";
public static String CFG_WAILA_ALPHA = "waila.cfg.alpha";
public static String CFG_WAILA_BGCOLOR = "waila.cfg.bgcolor";