Compare commits

...
11 Commits
Author SHA1 Message Date
SuperSoupr 452fbfa47c Change progress bars lengths (#71) 2026-07-19 13:47:43 +03:00
Guillaume MercierandGuillaume Mercier d8477007c9 Add compat for fluid colors for non GT5u fluids (#69)
Co-authored-by: Guillaume Mercier <[email protected]>
2026-06-05 16:01:44 -04:00
flamingowrangler2869 bd5905dfc0 fix comparator "substractor" mode spelling (#70) 2026-05-24 00:26:01 +00:00
Algent 80e761d83f Allow Waila to handle bigger NBT packet (#68) 2026-05-12 14:12:37 +02:00
MalTeeezandgithub-actions[bot] ef0f8b5329 Prevent overflowing of bars in tooltip renderers (#66)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-05-11 18:50:24 +02:00
Alexdoru 65e4a773d0 [Memory-opti:fix leak] fix client leak from DataAccessorFMP (#65) 2026-05-10 20:19:36 +02:00
jackandMartin Robertz 30717912fb Added GUI config factory (#63)
Co-authored-by: Martin Robertz <[email protected]>
2026-05-03 10:05:56 +02:00
Ranzu 1421b83a5b Styling of text and buttons (#64) 2026-04-29 18:24:21 +02:00
UltraProdigy 2de1ec4235 Fix Deps (#62) 2026-04-27 23:35:30 +02:00
Martin Robertz 91f8019410 update+gradle+deps+bs 2026-04-27 12:25:53 +02:00
UltraProdigy 59157ec1e3 Optimize Images & Workflow (#61) 2026-04-26 18:20:36 +00:00
25 changed files with 320 additions and 173 deletions

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
name: Optimize images
on:
pull_request:
branches: [ master, main, release/** ]
paths:
- "**/*.png"
push:
branches: [ master, main, release/** ]
paths:
- "**/*.png"
jobs:
optimize-images:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.yml@master
secrets: inherit
+13 -13
View File
@@ -1,24 +1,24 @@
// Add your dependencies here
dependencies {
implementation('com.github.GTNewHorizons:NotEnoughItems:2.8.55-GTNH:dev')
implementation('com.github.GTNewHorizons:NotEnoughItems:2.8.93-GTNH:dev')
shadowImplementation('au.com.bytecode:opencsv:2.4')
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.226:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.463:dev") { transitive = false }
runtimeOnlyNonPublishable("com.github.GTNewHorizons:WAILAPlugins:0.7.2:dev") {
exclude group: 'com.github.GTNewHorizons', module: 'waila'
}
runtimeOnlyNonPublishable("com.github.GTNewHorizons:EnderCore:0.5.5: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.15: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')
api("com.github.GTNewHorizons:GTNHLib:0.9.6:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:EnderCore:0.5.12:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:BuildCraft:7.1.57:dev")
runtimeOnlyNonPublishable(deobfCurse("cofh-lib-220333:2388748"))
runtimeOnlyNonPublishable(deobfCurse("extrautils-225561:2264383"))
runtimeOnlyNonPublishable("com.github.GTNewHorizons:OpenBlocks:1.12.12-GTNH:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Railcraft:9.17.26:dev")
runtimeOnlyNonPublishable(deobfCurse('thermal-foundation-222880:2388753'))
runtimeOnlyNonPublishable(deobfCurse('thermal-expansion-69163:2388759'))
runtimeOnlyNonPublishable(deobfCurse('thermal-dynamics-227443:2388756'))
implementation(deobfCurse('cofh-core-69162:2388751'))
api("com.github.GTNewHorizons:GTNHLib:0.9.54:dev")
}
+10 -10
View File
@@ -1,12 +1,12 @@
#This file is generated by updateDaemonJvm
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/93aeea858331bd6bb00ba94759830234/redirect
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/93aeea858331bd6bb00ba94759830234/redirect
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/7799fb2cb9f9eb382df2b8b6fb793b77/redirect
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/99a42fd36e2e41c7c8ed49f423f49fdf/redirect
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/93aeea858331bd6bb00ba94759830234/redirect
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/3087f28f30be41ab6818c16a488f5f8a/redirect
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/552c7bffe0370c66410a51c55985b511/redirect
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c2dd35c9d0aaf0ba6ad0791320f99dfc/redirect
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/e5810bd7fd1f8a586644409d395a7e55/redirect
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/7b3c4877c0749019e6805bb61e421497/redirect
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/8e1d9ee5d0f13e442218f6884a306da1/redirect
toolchainVersion=25
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-9.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+1 -1
View File
@@ -57,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.18'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.24'
}
+2 -1
View File
@@ -40,7 +40,8 @@ import mcp.mobius.waila.utils.ModIdentification;
name = "Waila",
version = Tags.GRADLETOKEN_VERSION,
dependencies = "after:NotEnoughItems@[1.0.4.0,)",
acceptableRemoteVersions = "*")
acceptableRemoteVersions = "*",
guiFactory = "mcp.mobius.waila.client.WailaGuiFactory")
public class Waila {
// The instance of your mod that Forge uses.
@@ -12,18 +12,18 @@ import mcp.mobius.waila.utils.NBTUtil;
public class DataAccessorFMP implements IWailaFMPAccessor {
String id;
World world;
EntityPlayer player;
MovingObjectPosition mop;
Vec3 renderingvec = null;
TileEntity entity;
NBTTagCompound partialNBT = null;
NBTTagCompound remoteNBT = null;
long timeLastUpdate = System.currentTimeMillis();
double partialFrame;
public static final DataAccessorFMP instance = new DataAccessorFMP();
public static DataAccessorFMP instance = new DataAccessorFMP();
private String id;
private World world;
private EntityPlayer player;
private MovingObjectPosition mop;
private Vec3 renderingvec;
private TileEntity tileEntity;
private NBTTagCompound partialNBT;
private double partialFrame;
private DataAccessorFMP() {}
public void set(World _world, EntityPlayer _player, MovingObjectPosition _mop, NBTTagCompound _partialNBT,
String id) {
@@ -35,13 +35,24 @@ public class DataAccessorFMP implements IWailaFMPAccessor {
this.world = _world;
this.player = _player;
this.mop = _mop;
this.entity = world.getTileEntity(_mop.blockX, _mop.blockY, _mop.blockZ);
this.tileEntity = world.getTileEntity(_mop.blockX, _mop.blockY, _mop.blockZ);
this.partialNBT = _partialNBT;
this.id = id;
this.renderingvec = renderVec;
this.partialFrame = partialTicks;
}
public void reset() {
id = null;
world = null;
player = null;
mop = null;
renderingvec = null;
tileEntity = null;
partialNBT = null;
partialFrame = 0.0D;
}
@Override
public World getWorld() {
return this.world;
@@ -54,7 +65,7 @@ public class DataAccessorFMP implements IWailaFMPAccessor {
@Override
public TileEntity getTileEntity() {
return this.entity;
return this.tileEntity;
}
@Override
@@ -69,12 +80,9 @@ public class DataAccessorFMP implements IWailaFMPAccessor {
@Override
public NBTTagCompound getFullNBTData() {
if (this.entity == null) return null;
if (this.isTagCorrect(this.remoteNBT)) return this.remoteNBT;
if (this.tileEntity == null) return null;
NBTTagCompound tag = new NBTTagCompound();
this.entity.writeToNBT(tag);
this.tileEntity.writeToNBT(tag);
return tag;
}
@@ -98,20 +106,4 @@ public class DataAccessorFMP implements IWailaFMPAccessor {
return this.id;
}
private boolean isTagCorrect(NBTTagCompound tag) {
if (tag == null) {
this.timeLastUpdate = System.currentTimeMillis() - 250;
return false;
}
int x = tag.getInteger("x");
int y = tag.getInteger("y");
int z = tag.getInteger("z");
if (x == this.mop.blockX && y == this.mop.blockY && z == this.mop.blockZ) return true;
else {
this.timeLastUpdate = System.currentTimeMillis() - 250;
return false;
}
}
}
@@ -0,0 +1,30 @@
package mcp.mobius.waila.client;
import java.util.Set;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import cpw.mods.fml.client.IModGuiFactory;
import mcp.mobius.waila.gui.screens.config.ScreenConfig;
public class WailaGuiFactory implements IModGuiFactory {
@Override
public void initialize(Minecraft minecraftInstance) {}
@Override
public Class<? extends GuiScreen> mainConfigGuiClass() {
return ScreenConfig.class;
}
@Override
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
return null;
}
@Override
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
return null;
}
}
@@ -10,17 +10,20 @@ public class LabelFixedFont extends WidgetBase {
protected String text = "";
protected int color;
protected boolean shadow;
public LabelFixedFont(IWidget parent, String text) {
super(parent);
this.setText(text);
this.color = 0xFFFFFF;
this.shadow = false;
}
public LabelFixedFont(IWidget parent, String text, int color) {
super(parent);
this.setText(text);
this.color = color;
this.shadow = false;
}
@Override
@@ -39,6 +42,10 @@ public class LabelFixedFont extends WidgetBase {
this.color = color;
}
public void setShadow(boolean shadow) {
this.shadow = shadow;
}
private void updateGeometry() {
if (this.geom == null) this.geom = new WidgetGeometry(0, 0, 50, 50, CType.ABSXY, CType.ABSXY);
@@ -56,7 +63,8 @@ public class LabelFixedFont extends WidgetBase {
@Override
public void draw(Point pos) {
this.saveGLState();
this.mc.fontRenderer.drawString(this.text, pos.getX(), pos.getY(), this.color);
if (this.shadow) this.mc.fontRenderer.drawStringWithShadow(this.text, pos.getX(), pos.getY(), this.color);
else this.mc.fontRenderer.drawString(this.text, pos.getX(), pos.getY(), this.color);
this.loadGLState();
}
}
@@ -15,8 +15,17 @@ import mcp.mobius.waila.gui.widgets.WidgetBase;
public abstract class ButtonBase extends WidgetBase {
protected static final int BUTTON_TEX_U = 0;
protected static final int BUTTON_TEX_V_BASE = 66;
protected static final int BUTTON_TEX_V_STEP = 20;
protected static final int BUTTON_TEX_W = 200;
protected static final int BUTTON_TEX_H = 20;
protected static final int BUTTON_BORDER = 2;
protected static final int COLOR_TEXT = 0xffffff;
protected static final int COLOR_TEXT_HOVER = 0xffffa0;
protected boolean mouseOver = false;
protected static ResourceLocation widgetsTexture = new ResourceLocation("textures/gui/widgets.png");
protected static final ResourceLocation widgetsTexture = new ResourceLocation("textures/gui/widgets.png");
public ButtonBase(IWidget parent) {
super(parent);
@@ -25,10 +34,14 @@ public abstract class ButtonBase extends WidgetBase {
@Override
public void draw() {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int textColor = this.mouseOver ? COLOR_TEXT_HOVER : COLOR_TEXT;
for (IWidget widget : this.widgets.values())
if (widget instanceof LabelFixedFont) if (this.mouseOver) ((LabelFixedFont) widget).setColor(0xffffa0);
else((LabelFixedFont) widget).setColor(0xffffff);
for (IWidget widget : this.widgets.values()) {
if (!(widget instanceof LabelFixedFont)) continue;
LabelFixedFont label = (LabelFixedFont) widget;
label.setShadow(true);
label.setColor(textColor);
}
super.draw();
}
@@ -40,20 +53,108 @@ public abstract class ButtonBase extends WidgetBase {
if (this.mouseOver) texOffset = 1;
this.mc.getTextureManager().bindTexture(widgetsTexture);
UIHelper.drawTexture(
this.getPos().getX(),
this.getPos().getY(),
this.getSize().getX(),
this.getSize().getY(),
0,
66 + texOffset * 20,
200,
20);
this.drawVanillaButton(texOffset);
this.loadGLState();
}
protected void drawVanillaButton(int texOffset) {
int x = this.getPos().getX();
int y = this.getPos().getY();
int width = this.getSize().getX();
int height = this.getSize().getY();
int v = BUTTON_TEX_V_BASE + texOffset * BUTTON_TEX_V_STEP;
this.mc.getTextureManager().bindTexture(widgetsTexture);
if (width <= 0 || height <= 0) return;
int borderX = Math.min(BUTTON_BORDER, width / 2);
int borderY = Math.min(BUTTON_BORDER, height / 2);
int midW = width - borderX * 2;
int midH = height - borderY * 2;
int srcMidW = BUTTON_TEX_W - BUTTON_BORDER * 2;
int srcMidH = BUTTON_TEX_H - BUTTON_BORDER * 2;
// Corners
UIHelper.drawTexture(x, y, borderX, borderY, BUTTON_TEX_U, v, BUTTON_BORDER, BUTTON_BORDER);
UIHelper.drawTexture(
x + width - borderX,
y,
borderX,
borderY,
BUTTON_TEX_W - BUTTON_BORDER,
v,
BUTTON_BORDER,
BUTTON_BORDER);
UIHelper.drawTexture(
x,
y + height - borderY,
borderX,
borderY,
BUTTON_TEX_U,
v + BUTTON_TEX_H - BUTTON_BORDER,
BUTTON_BORDER,
BUTTON_BORDER);
UIHelper.drawTexture(
x + width - borderX,
y + height - borderY,
borderX,
borderY,
BUTTON_TEX_W - BUTTON_BORDER,
v + BUTTON_TEX_H - BUTTON_BORDER,
BUTTON_BORDER,
BUTTON_BORDER);
if (midW > 0) {
// Top + bottom edges
UIHelper.drawTexture(x + borderX, y, midW, borderY, BUTTON_BORDER, v, srcMidW, BUTTON_BORDER);
UIHelper.drawTexture(
x + borderX,
y + height - borderY,
midW,
borderY,
BUTTON_BORDER,
v + BUTTON_TEX_H - BUTTON_BORDER,
srcMidW,
BUTTON_BORDER);
}
if (midH > 0) {
// Left + right edges
UIHelper.drawTexture(
x,
y + borderY,
borderX,
midH,
BUTTON_TEX_U,
v + BUTTON_BORDER,
BUTTON_BORDER,
srcMidH);
UIHelper.drawTexture(
x + width - borderX,
y + borderY,
borderX,
midH,
BUTTON_TEX_W - BUTTON_BORDER,
v + BUTTON_BORDER,
BUTTON_BORDER,
srcMidH);
}
if (midW > 0 && midH > 0) {
// Center
UIHelper.drawTexture(
x + borderX,
y + borderY,
midW,
midH,
BUTTON_BORDER,
v + BUTTON_BORDER,
srcMidW,
srcMidH);
}
}
@Override
public void onMouseEnter(MouseEvent event) {
mouseOver = true;
@@ -4,7 +4,6 @@ import org.lwjgl.util.Point;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.helpers.UIHelper;
import mcp.mobius.waila.gui.interfaces.IWidget;
public class ButtonBooleanConfig extends ButtonBoolean {
@@ -47,17 +46,7 @@ public class ButtonBooleanConfig extends ButtonBoolean {
if (!ConfigHandler.instance().forcedConfigs.containsKey(this.configKey)) super.draw(pos);
else {
this.saveGLState();
int texOffset = -1;
this.mc.getTextureManager().bindTexture(widgetsTexture);
UIHelper.drawTexture(
this.getPos().getX(),
this.getPos().getY(),
this.getSize().getX(),
this.getSize().getY(),
0,
66 + texOffset * 20,
200,
20);
this.drawVanillaButton(-1);
this.loadGLState();
}
}
@@ -5,7 +5,6 @@ import org.lwjgl.util.Point;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.helpers.UIHelper;
import mcp.mobius.waila.gui.interfaces.IWidget;
public class ButtonBooleanConfigRemote extends ButtonBooleanConfig {
@@ -41,17 +40,7 @@ public class ButtonBooleanConfigRemote extends ButtonBooleanConfig {
super.draw(pos);
else {
this.saveGLState();
int texOffset = -1;
this.mc.getTextureManager().bindTexture(widgetsTexture);
UIHelper.drawTexture(
this.getPos().getX(),
this.getPos().getY(),
this.getSize().getX(),
this.getSize().getY(),
0,
66 + texOffset * 20,
200,
20);
this.drawVanillaButton(-1);
this.loadGLState();
}
}
@@ -35,9 +35,13 @@ public class DecoratorFMP implements IWailaBlockDecorator {
accessor.getRenderingPosition(),
accessor.getPartialFrame());
for (List<IWailaFMPDecorator> providersList : ModuleRegistrar.instance().getFMPDecorators(id).values())
for (IWailaFMPDecorator provider : providersList)
for (List<IWailaFMPDecorator> providersList : ModuleRegistrar.instance().getFMPDecorators(id)
.values()) {
for (IWailaFMPDecorator provider : providersList) {
provider.decorateBlock(itemStack, DataAccessorFMP.instance, config);
}
}
DataAccessorFMP.instance.reset();
}
}
}
@@ -41,9 +41,11 @@ public class HUDHandlerFMP implements IWailaDataProvider {
for (List<IWailaFMPProvider> providersList : ModuleRegistrar.instance().getHeadFMPProviders(id)
.values()) {
for (IWailaFMPProvider provider : providersList)
for (IWailaFMPProvider provider : providersList) {
currenttip = provider.getWailaHead(itemStack, currenttip, DataAccessorFMP.instance, config);
}
}
DataAccessorFMP.instance.reset();
}
}
@@ -64,9 +66,11 @@ public class HUDHandlerFMP implements IWailaDataProvider {
for (List<IWailaFMPProvider> providersList : ModuleRegistrar.instance().getBodyFMPProviders(id)
.values()) {
for (IWailaFMPProvider provider : providersList)
for (IWailaFMPProvider provider : providersList) {
currenttip = provider.getWailaBody(itemStack, currenttip, DataAccessorFMP.instance, config);
}
}
DataAccessorFMP.instance.reset();
}
}
@@ -87,9 +91,11 @@ public class HUDHandlerFMP implements IWailaDataProvider {
for (List<IWailaFMPProvider> providersList : ModuleRegistrar.instance().getTailFMPProviders(id)
.values()) {
for (IWailaFMPProvider provider : providersList)
for (IWailaFMPProvider provider : providersList) {
currenttip = provider.getWailaTail(itemStack, currenttip, DataAccessorFMP.instance, config);
}
}
DataAccessorFMP.instance.reset();
}
}
@@ -90,20 +90,20 @@ public enum WailaPacketHandler {
}
public void writeNBT(ByteBuf target, NBTTagCompound tag) throws IOException {
if (tag == null) target.writeShort(-1);
if (tag == null) target.writeInt(-1);
else {
byte[] abyte = CompressedStreamTools.compress(tag);
target.writeShort((short) abyte.length);
target.writeInt(abyte.length);
target.writeBytes(abyte);
}
}
public NBTTagCompound readNBT(ByteBuf dat) throws IOException {
short short1 = dat.readShort();
int val = dat.readInt();
if (short1 < 0) return null;
if (val < 0) return null;
else {
byte[] abyte = new byte[short1];
byte[] abyte = new byte[val];
dat.readBytes(abyte);
return CompressedStreamTools.func_152457_a(abyte, NBTSizeTracker.field_152451_a);
}
@@ -179,4 +179,23 @@ public class DisplayUtil {
DisplayUtil.drawTexturedModalRect(x, y, icon.u, icon.v, sx, sy, icon.su, icon.sv);
}
public static void drawRect(Tessellator tessellator, int x, int y, double z, int width, int height, double minU,
double minV, double maxU, double maxV) {
tessellator.addVertexWithUV(x, y + height, z, minU, maxV);
tessellator.addVertexWithUV(x + width, y + height, z, maxU, maxV);
tessellator.addVertexWithUV(x + width, y, z, maxU, minV);
tessellator.addVertexWithUV(x, y, z, minU, minV);
}
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);
}
}
@@ -12,14 +12,12 @@ import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
import gregtech.api.util.GTUtil;
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;
@@ -37,17 +35,39 @@ public class TTRenderFluidBar implements IWailaVariableWidthTooltipRenderer {
public TTRenderFluidBar() {
if (LoadedMods.GT5U) {
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);
FluidStack tFStack = FluidUtils.getWildcardFluidStack(fluidName, 1000);
if (tFStack == null) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
return;
}
Fluid tFluid = tFStack.getFluid();
if (tFluid == null) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
return;
}
// duplicate code to prevent extra stack allocations
int tColor = tFluid.getColor();
float r = ((tColor >>> 16) & 0xFF) / (float) 0xFF;
float g = ((tColor >>> 8) & 0xFF) / (float) 0xFF;
float b = (tColor & 0xFF) / (float) 0xFF;
GL11.glColor4f(r, g, b, 1.0F);
};
} else {
bindColor = (fluidName) -> GL11.glColor4f(1F, 1F, 1F, 1F);
bindColor = (fluidName) -> {
Fluid tFluid = FluidRegistry.getFluid(fluidName);
if (tFluid == null) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
return;
}
// duplicate code to prevent extra stack allocations
int tColor = tFluid.getColor();
float r = ((tColor >>> 16) & 0xFF) / (float) 0xFF;
float g = ((tColor >>> 8) & 0xFF) / (float) 0xFF;
float b = (tColor & 0xFF) / (float) 0xFF;
GL11.glColor4f(r, g, b, 1.0F);
};
}
}
@Override
@@ -83,13 +103,13 @@ public class TTRenderFluidBar implements IWailaVariableWidthTooltipRenderer {
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 i = (int) ((double) (maxStringW - 2) * (amount / Math.max(capacity, amount)));
int j = 0;
for (; i > height; i = i - height) {
drawRectFromIcon(tessellator, 1 + (j * height), 0, 0, icon, height, height);
j++;
}
if (i > 0) drawRect(
if (i > 0) DisplayUtil.drawRect(
tessellator,
1 + (j * height),
0,
@@ -108,13 +128,13 @@ public class TTRenderFluidBar implements IWailaVariableWidthTooltipRenderer {
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);
DisplayUtil.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);
}
drawThickBeveledBox(0, 0, maxStringW, height, 1, 0xFF505050, 0xFF505050, -1);
DisplayUtil.drawThickBeveledBox(0, 0, maxStringW, height, 1, 0xFF505050, 0xFF505050, -1);
DisplayUtil.drawString(
buildDisplayText(amount, capacity, localizedName, isEmpty),
@@ -131,31 +151,22 @@ public class TTRenderFluidBar implements IWailaVariableWidthTooltipRenderer {
public static void drawRectFromIcon(Tessellator tessellator, int x, int y, double z, IIcon icon, int width,
int height) {
drawRect(tessellator, x, y, z, width, height, icon.getMinU(), icon.getMinV(), icon.getMaxU(), icon.getMaxV());
}
public static void drawRect(Tessellator tessellator, int x, int y, double z, int width, int height, double minU,
double minV, double maxU, double maxV) {
tessellator.addVertexWithUV(x, y + height, z, minU, maxV);
tessellator.addVertexWithUV(x + width, y + height, z, maxU, maxV);
tessellator.addVertexWithUV(x + width, y, z, maxU, minV);
tessellator.addVertexWithUV(x, y, z, minU, minV);
}
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);
DisplayUtil.drawRect(
tessellator,
x,
y,
z,
width,
height,
icon.getMinU(),
icon.getMinV(),
icon.getMaxU(),
icon.getMaxV());
}
@Override
public void setMaxLineWidth(int width) {
maxStringW = width + 2;
maxStringW = width;
}
@Override
@@ -5,7 +5,6 @@ import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.fo
import java.awt.Dimension;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
@@ -47,13 +46,13 @@ public class TTRenderRFBar implements IWailaVariableWidthTooltipRenderer {
// Draw dark (uncharged) background for whole bar first
for (int i = 0; i < (maxStringW - 2); i += width) {
drawRect(tessellator, 1 + i, 0, 0, width, height, 0.0, 0.0, 0.5, 1.0);
DisplayUtil.drawRect(tessellator, 1 + i, 0, 0, width, height, 0.0, 0.0, 0.5, 1.0);
}
double i = (double) (maxStringW - 2) * amount / capacity;
double i = (double) (maxStringW - 2) * ((double) amount / Math.max(capacity, amount));
int drawnRects = 0;
for (; i > width; i -= width) {
drawRect(tessellator, 1 + (drawnRects * width), 0, 0, width, height, 0.5, 0.0, 1.0, 1.0);
DisplayUtil.drawRect(tessellator, 1 + (drawnRects * width), 0, 0, width, height, 0.5, 0.0, 1.0, 1.0);
drawnRects++;
}
// Do less than full increments just as much as they take up on the scaled texture
@@ -61,14 +60,14 @@ public class TTRenderRFBar implements IWailaVariableWidthTooltipRenderer {
tessellator.draw();
// Border
drawThickBeveledBox(0, 0, maxStringW, height, 1, 0xFF505050, 0xFF505050, -1);
DisplayUtil.drawThickBeveledBox(0, 0, maxStringW, height, 1, 0xFF505050, 0xFF505050, -1);
// Gradient
GL11.glEnable(GL11.GL_BLEND);
GL11.glColor4f(1F, 1F, 1F, 0.5F);
mc.getTextureManager().bindTexture(gradientTexture);
tessellator.startDrawingQuads();
drawRect(tessellator, 1, 1, 0, maxStringW - 2, height - 2, 0, 0, 1, 1);
DisplayUtil.drawRect(tessellator, 1, 1, 0, maxStringW - 2, height - 2, 0, 0, 1, 1);
tessellator.draw();
DisplayUtil.drawString(buildDisplayText(amount, capacity), 2, 2, 0xFFFFFFFF, true);
@@ -78,14 +77,6 @@ public class TTRenderRFBar implements IWailaVariableWidthTooltipRenderer {
return String.format("%s / %s RF", formatNumber(amount), formatNumber(capacity));
}
public static void drawRect(Tessellator tessellator, int x, int y, double z, int width, int height, double minU,
double minV, double maxU, double maxV) {
tessellator.addVertexWithUV(x, y + height, z, minU, maxV);
tessellator.addVertexWithUV(x + width, y + height, z, maxU, maxV);
tessellator.addVertexWithUV(x + width, y, z, maxU, minV);
tessellator.addVertexWithUV(x, y, z, minU, minV);
}
public static void drawRectD(Tessellator tessellator, double x, double y, double z, double width, double height,
double minU, double minV, double maxU, double maxV) {
tessellator.addVertexWithUV(x, y + height, z, minU, maxV);
@@ -94,20 +85,9 @@ public class TTRenderRFBar implements IWailaVariableWidthTooltipRenderer {
tessellator.addVertexWithUV(x, y, z, minU, minV);
}
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;
maxStringW = width;
}
@Override
@@ -92,7 +92,7 @@ hud.msg.on=On
hud.msg.state=State
hud.msg.delay=Delay
hud.msg.comparator=Comparator
hud.msg.substractor=Substractor
hud.msg.substractor=Subtractor
hud.msg.record=Record
hud.msg.offers=Offers
@@ -155,4 +155,4 @@ option.general.showhp=Show entities health
option.general.showcrop=Show crop growth
option.thaumcraft.aspects=Show aspects
nei.options.keys.showenchant=Show enchanting values
nei.options.keys.showenchant=Show enchanting values
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 B

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 606 B

After

Width:  |  Height:  |  Size: 554 B