Compare commits

...
2 Commits
Author SHA1 Message Date
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
3 changed files with 7 additions and 7 deletions

No files matched your search

@@ -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);
}
@@ -83,7 +83,7 @@ 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);
@@ -50,7 +50,7 @@ public class TTRenderRFBar implements IWailaVariableWidthTooltipRenderer {
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);