Upload files to "src/openonyx/ui"

This commit is contained in:
winterflyt committed 2026-11-30 06:17:26 +02:00
1 parent 71261547e6
commit 9dff1477a3
5 files changed
+1189

No files matched your search

+869
View File
@@ -0,0 +1,869 @@
package openonyx.ui;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.item.ItemStack;
import openonyx.core.OnyxClient;
import openonyx.features.player.InventoryManager;
import openonyx.history.internal.ItemListSetting;
import openonyx.input.CharInput;
import openonyx.input.KeyInput;
import openonyx.render.Render2D;
import openonyx.render.group_d.Animation;
import openonyx.render.group_d.Easings;
import openonyx.render.group_e.FontStyle;
import openonyx.theme.Fonts;
import openonyx.theme.ThemeManager;
import openonyx.ui.internal.SearchField;
import openonyx.ui.internal.SegmentedControl;
import openonyx.ui.internal.TextInput;
import openonyx.ui.internal.UiButton;
import openonyx.ui.internal.UiButtonMode;
import openonyx.utilities.ItemCatalog;
import openonyx.utilities.ItemCatalogData;
import openonyx.utilities.ItemSpec;
import openonyx.utilities.ItemSpecMode;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
public class InventoryLayoutScreen extends GuiScreen {
private boolean Aa;
private static final float Ca = 4.0F;
private static final float Ba = 49.0F;
private final UiButton uiButton;
private float Ea;
private static final float La = 116.0F;
private float Ma;
private float ba;
private final Render2D render2D;
private static final float Fa = 260.0F;
private long Ja;
private int ja;
private static final float ma = 28.0F;
private static final int da = 400;
private static final float fa = 13.0F;
private float Ka;
private static final float ha = 18.0F;
private static final float Ha = 32.0F;
private static final float ia = 18.0F;
private float Da;
private float la;
private final Animation[] animations;
private static final float ga = 4.0F;
private static final float ca = 20.0F;
private ItemSpec itemSpec;
private static final float T = 97.0F;
private static final float S = 100.0F;
private int o;
private static final float U = 430.0F;
private static final float X = 3.0F;
private static final int w = 1;
private final List<InventoryLayoutScreenData> z;
private float v;
private static final float s = 5.0F;
private static final int Z = 2;
private static final float O = 13.0F;
private final List<InventoryLayoutScreenData> inventoryLayoutScreenDatas;
private static final float q = 2.0F;
private int x;
private final UiButton uiButton2;
private final InventoryManager y = OnyxClient.moduleManager.inventoryManager;
private final List<InventoryLayoutScreenData> inventoryLayoutScreenDatas2;
private float Y;
private static final float r = 560.0F;
private float W;
private static final float P = 5.0F;
private static final float V = 26.0F;
private final SearchField searchField;
private final List<InventoryLayoutScreenData> inventoryLayoutScreenDatas3;
private float t;
private static final float b = 8.0F;
private static final float E = 18.0F;
private final GuiScreen guiScreen;
private static final float G = 22.0F;
private static final float A = 8.0F;
private float K;
private static final float B = 16.0F;
private static final float C = 3.0F;
private float J;
private final UiButton uiButton3;
private float c;
private float a;
private List<ItemCatalogData> itemCatalogDatas;
private static final float g = 92.0F;
private static final int M = 0;
private static final float L = 16.0F;
private float j;
private float m;
private final SegmentedControl segmentedControl;
private static final float l = 20.0F;
private static final float I = 9.0F;
private float d;
private static final float i = 7.0F;
private static final float f = 38.0F;
private static final float H = 120.0F;
private String e;
private void D() {
InventoryLayoutScreen inventoryLayoutScreen1 = this;
inventoryLayoutScreen1.Ma = Math.min(560.0F, inventoryLayoutScreen1.width - 40.0F);
inventoryLayoutScreen1.Ea = Math.min(430.0F, inventoryLayoutScreen1.height - 40.0F);
inventoryLayoutScreen1.J = (inventoryLayoutScreen1.width - inventoryLayoutScreen1.Ma) / 2.0F;
inventoryLayoutScreen1.Da = (inventoryLayoutScreen1.height - inventoryLayoutScreen1.Ea) / 2.0F;
inventoryLayoutScreen1.a = inventoryLayoutScreen1.J + 18.0F;
inventoryLayoutScreen1.W = inventoryLayoutScreen1.Ma - 36.0F;
float gx = Math.min(260.0F, inventoryLayoutScreen1.W);
float fx = inventoryLayoutScreen1.Da + 42.0F;
inventoryLayoutScreen1.segmentedControl.setBounds(inventoryLayoutScreen1.J + (inventoryLayoutScreen1.Ma - gx) / 2.0F, fx, gx, 30.0F);
inventoryLayoutScreen1.c = fx + 30.0F + 14.0F;
float h = inventoryLayoutScreen1.c + 97.0F + 10.0F;
inventoryLayoutScreen1.searchField.setBounds(inventoryLayoutScreen1.a, h, inventoryLayoutScreen1.W, 40.0F);
inventoryLayoutScreen1.Y = h + 40.0F + 8.0F;
float ix;
inventoryLayoutScreen1.j = (ix = inventoryLayoutScreen1.Da + inventoryLayoutScreen1.Ea - 18.0F - 30.0F) - 12.0F;
fx = 292.0F;
fx = inventoryLayoutScreen1.J + inventoryLayoutScreen1.Ma - 18.0F - fx;
inventoryLayoutScreen1.uiButton3.setBounds(fx, ix, 92.0F, 30.0F);
inventoryLayoutScreen1.uiButton.setBounds(fx + 92.0F + 8.0F, ix, 92.0F, 30.0F);
inventoryLayoutScreen1.uiButton2.setBounds(fx + 200.0F, ix, 92.0F, 30.0F);
}
private void D(RenderContext renderContext) {
this.inventoryLayoutScreenDatas2.clear();
this.inventoryLayoutScreenDatas.clear();
float fx;
if (!((fx = this.j - this.Y) <= 0.0F)) {
this.render2D.pushScissor(this.a, this.Y, this.W, fx);
float gx;
float h = this.d(renderContext, this.L(renderContext, gx = this.Y - this.d) + 8.0F);
this.render2D.popScissor();
this.ba = Math.max(0.0F, h + this.d - this.j);
this.d = Math.min(this.d, this.ba);
this.L(this.Y, fx, this.d, this.ba);
}
}
private String L(ItemSpec itemSpec) {
return this.render2D.trimToWidth(Fonts.FONT_STYLE16, itemSpecx.d(), 116.0F);
}
private void L(float f, float g, float h, float i) {
InventoryLayoutScreen inventoryLayoutScreen1 = this;
if (!(ix <= 0.0F) && !(gx <= 0.0F)) {
float lx = gx + ix;
float mx = Math.max(18.0F, gx * gx / lx);
float jx = gx - mx;
float k = inventoryLayoutScreen1.a + inventoryLayoutScreen1.W - 3.0F;
inventoryLayoutScreen1.render2D
.roundedRect(k, fx, 3.0F, gx, Float.MAX_VALUE, ThemeManager.withAlpha(ThemeManager.getPalette().outlineVariant(), 0.35F));
inventoryLayoutScreen1.render2D
.roundedRect(k, fx + jx * (h / ix), 3.0F, mx, Float.MAX_VALUE, ThemeManager.withAlpha(ThemeManager.getPalette().onSurfaceVariant(), 0.7F));
}
}
private float d(RenderContext renderContext, float f) {
InventoryLayoutScreen inventoryLayoutScreen1 = this;
int k = Math.max(1, (int)((inventoryLayoutScreen1.W - 7.0F + 4.0F) / 32.0F));
float gx = fx;
int ix;
for (int ox = ix = 0; ox < inventoryLayoutScreen1.itemCatalogDatas.size(); ox = ++ix) {
int jx = ix % k;
int mx = ix / k;
float n = inventoryLayoutScreen1.a + 32.0F * jx;
float h;
gx = (h = fx + 32.0F * mx) + 28.0F;
ItemCatalogData itemCatalogData;
ItemSpec itemSpecx;
if (!(h + 28.0F < inventoryLayoutScreen1.Y)
&& !(h > inventoryLayoutScreen1.j)
&& (itemSpecx = ItemSpec.L((itemCatalogData = inventoryLayoutScreen1.itemCatalogDatas.get(ix)).stack())) != null) {
int lx = inventoryLayoutScreen1.L(itemSpecx);
boolean bl = renderContext.H >= n
&& renderContext.H < n + 28.0F
&& renderContext.f >= h
&& renderContext.f < h + 28.0F
&& renderContext.f >= inventoryLayoutScreen1.Y
&& renderContext.f < inventoryLayoutScreen1.j;
lx = lx
? ThemeManager.getPalette().primaryContainer()
: (bl ? ThemeManager.getPalette().surfaceContainerHighest() : ThemeManager.getPalette().surfaceContainerHigh());
inventoryLayoutScreen1.render2D.roundedRect(n, h, 28.0F, 28.0F, 4.0F, lx);
inventoryLayoutScreen1.L(itemCatalogData.stack(), n + 5.0F, h + 5.0F, 18.0F);
inventoryLayoutScreen1.inventoryLayoutScreenDatas.add(new InventoryLayoutScreenData(n, h, 28.0F, 28.0F, itemSpecx, -1));
if (bl) {
inventoryLayoutScreen1.e = itemCatalogData.name();
}
}
}
if (inventoryLayoutScreen1.itemCatalogDatas.isEmpty()) {
inventoryLayoutScreen1.render2D
.drawText(
Fonts.FONT_STYLE2,
"No items match that search",
inventoryLayoutScreen1.a,
fx + 4.0F,
ThemeManager.withAlpha(ThemeManager.getPalette().onSurfaceVariant(), 0.6F)
);
return fx + 22.0F;
} else {
return gx;
}
}
@Override
public void handleMouseInput() throws IOException {
InventoryLayoutScreen inventoryLayoutScreen1 = this;
int ix;
if ((ix = Mouse.getEventDWheel()) != 0) {
float gx = ix / 120.0F;
float fx;
if ((fx = inventoryLayoutScreen1.d()) >= inventoryLayoutScreen1.Ka
&& fx < inventoryLayoutScreen1.Ka + inventoryLayoutScreen1.K
&& inventoryLayoutScreen1.v > 0.0F) {
inventoryLayoutScreen1.m = Math.clamp(inventoryLayoutScreen1.m - gx * 27.0F, 0.0F, inventoryLayoutScreen1.v);
} else {
inventoryLayoutScreen1.d = Math.clamp(inventoryLayoutScreen1.d - gx * 32.0F, 0.0F, inventoryLayoutScreen1.ba);
}
} else {
inventoryLayoutScreen1.handleMouseInput();
}
}
private ItemListSetting L() {
switch (this.ja) {
case 1:
while (false) {
}
return this.y.keep;
case 2:
return this.y.drop;
default:
return null;
}
}
private String d() {
return this.ja == 0
? new StringBuilder().insert(0, "Slot ").append(this.o + 1).append(" is not claimed by anything yet").toString()
: "Nothing on this list";
}
private void L(float f, float g) {
InventoryLayoutScreen inventoryLayoutScreen1 = this;
Iterator iterator;
for (Iterator iterator1 = iterator = inventoryLayoutScreen1.z.iterator(); iterator1.hasNext(); iterator1 = iterator) {
InventoryLayoutScreenData inventoryLayoutScreenData;
if ((inventoryLayoutScreenData = (InventoryLayoutScreenData)iterator.next()).L(fx, gx)) {
InventoryLayoutScreen inventoryLayoutScreen2;
if (inventoryLayoutScreen1.x >= 0) {
inventoryLayoutScreen1.y.slots.L(inventoryLayoutScreen1.x, inventoryLayoutScreenData.slot(), inventoryLayoutScreen1.itemSpec);
inventoryLayoutScreen2 = inventoryLayoutScreen1;
} else {
inventoryLayoutScreen1.y.slots.L(inventoryLayoutScreenData.slot(), inventoryLayoutScreen1.itemSpec);
inventoryLayoutScreen2 = inventoryLayoutScreen1;
}
inventoryLayoutScreen2.d(inventoryLayoutScreenData.slot());
return;
}
}
if (inventoryLayoutScreen1.x >= 0) {
inventoryLayoutScreen1.y.slots.d(inventoryLayoutScreen1.x, inventoryLayoutScreen1.itemSpec);
}
}
private void d(int i) {
if (ix != this.o) {
this.animations[this.o].animateTo(0.0F, 250.0F, Easings.EASING2);
this.o = ix;
this.animations[ix].animateTo(1.0F, 300.0F, Easings.EASING2);
this.m = 0.0F;
}
}
public InventoryLayoutScreen(GuiScreen guiScreen) {
this.render2D = new Render2D();
this.searchField = new SearchField("Search items");
String[] strings = new String[3];
boolean bl1 = true;
strings[0] = "Slots";
strings[1] = "Keep";
strings[2] = "Drop";
this.segmentedControl = new SegmentedControl(strings, l -> {
this.ja = lx;
this.d = 0.0F;
this.m = 0.0F;
});
this.uiButton3 = new UiButton(UiButtonMode.OUTLINED, "Clear", () -> {
InventoryLayoutScreen inventoryLayoutScreen1 = this;
ItemListSetting itemListSetting;
if ((itemListSetting = inventoryLayoutScreen1.L()) == null) {
inventoryLayoutScreen1.y.slots.L(inventoryLayoutScreen1.o);
} else {
itemListSetting.D();
}
});
this.uiButton = new UiButton(UiButtonMode.TONAL, "Reset", () -> {
this.y.slots.reset();
this.y.keep.reset();
this.y.drop.reset();
});
this.uiButton2 = new UiButton(UiButtonMode.FILLED, "Done", () -> {
TextInput.D();
this.mc.displayGuiScreen(this.guiScreen);
});
this.z = new ArrayList<>();
this.inventoryLayoutScreenDatas3 = new ArrayList<>();
this.inventoryLayoutScreenDatas2 = new ArrayList<>();
this.inventoryLayoutScreenDatas = new ArrayList<>();
Animation[] animations1 = new Animation[9];
boolean bl = true;
this.animations = animations1;
int k = 0;
this.itemCatalogDatas = List.of();
this.ja = 0;
this.x = -1;
this.guiScreen = guiScreenx;
for (int ix = 0; k < this.animations.length; k = ix) {
Animation[] animationsx = this.animations;
int jx = ix;
Animation animation = new Animation(ix == this.o ? 1.0F : 0.0F);
ix++;
animationsx[jx] = animation;
}
this.searchField.L(string -> {
this.itemCatalogDatas = ItemCatalog.L(string, 400);
this.d = 0.0F;
});
}
@Override
public void initGui() {
Keyboard.enableRepeatEvents(true);
this.Ja = 0L;
this.itemCatalogDatas = ItemCatalog.L(this.searchField.L(), 400);
}
private static int L(int i, int j, float f) {
fx = Math.clamp(fx, 0.0F, 1.0F);
int k = (int)((ix >>> 24 & 0xFF) + ((jx >>> 24 & 0xFF) - (ix >>> 24 & 0xFF)) * fx);
int lx = (int)((ix >>> 16 & 0xFF) + ((jx >>> 16 & 0xFF) - (ix >>> 16 & 0xFF)) * fx);
int mx = (int)((ix >>> 8 & 0xFF) + ((jx >>> 8 & 0xFF) - (ix >>> 8 & 0xFF)) * fx);
jx = (int)((ix & 0xFF) + ((jx & 0xFF) - (ix & 0xFF)) * fx);
return k << 24 | lx << 16 | mx << 8 | jx;
}
@Override
public void drawScreen(int i, int j, float f) {
InventoryLayoutScreen inventoryLayoutScreen1 = this;
inventoryLayoutScreen1.D();
fx = inventoryLayoutScreen1.L();
Animation[] animationsx = inventoryLayoutScreen1.animations;
int k = inventoryLayoutScreen1.animations.length;
int lx;
for (int ox = lx = 0; ox < k; ox = lx) {
Animation animation = animationsx[lx];
Animation animation1 = animationsx[lx];
lx++;
animation.update(fx);
}
RenderContext renderContext = new RenderContext(inventoryLayoutScreen1.render2D, fx, ix, jx);
inventoryLayoutScreen1.render2D.beginFrame();
InventoryLayoutScreen inventoryLayoutScreen2;
if (inventoryLayoutScreen1.mc.theWorld != null) {
inventoryLayoutScreen1.render2D.rect(0.0F, 0.0F, inventoryLayoutScreen1.width, inventoryLayoutScreen1.height, ThemeManager.scrim(0.7F));
inventoryLayoutScreen2 = inventoryLayoutScreen1;
} else {
inventoryLayoutScreen1.render2D.L(0.0F, 0.0F, inventoryLayoutScreen1.width, inventoryLayoutScreen1.height);
inventoryLayoutScreen2 = inventoryLayoutScreen1;
}
inventoryLayoutScreen2.render2D
.roundedRect(
inventoryLayoutScreen1.J,
inventoryLayoutScreen1.Da,
inventoryLayoutScreen1.Ma,
inventoryLayoutScreen1.Ea,
28.0F,
ThemeManager.getPalette().surfaceContainer()
);
inventoryLayoutScreen1.render2D
.drawText(Fonts.FONT_STYLE18, "Inventory rules", inventoryLayoutScreen1.a, inventoryLayoutScreen1.Da + 26.0F, ThemeManager.getPalette().onSurface());
inventoryLayoutScreen1.render2D
.drawTextRight(
Fonts.FONT_STYLE2,
inventoryLayoutScreen1.L(),
inventoryLayoutScreen1.J + inventoryLayoutScreen1.Ma - 18.0F,
inventoryLayoutScreen1.Da + 26.0F + 3.0F,
ThemeManager.withAlpha(ThemeManager.getPalette().onSurfaceVariant(), 0.85F)
);
inventoryLayoutScreen1.segmentedControl.update(renderContext);
inventoryLayoutScreen1.segmentedControl.render(renderContext);
inventoryLayoutScreen1.inventoryLayoutScreenDatas3.clear();
inventoryLayoutScreen1.z.clear();
inventoryLayoutScreen1.e = null;
if (inventoryLayoutScreen1.ja == 0) {
inventoryLayoutScreen1.d(renderContext);
inventoryLayoutScreen2 = inventoryLayoutScreen1;
inventoryLayoutScreen1.Ka = inventoryLayoutScreen1.c + 38.0F + 10.0F;
inventoryLayoutScreen1.K = L(49.0F);
inventoryLayoutScreen1.L(renderContext, inventoryLayoutScreen1.y.slots.L(inventoryLayoutScreen1.o), inventoryLayoutScreen1.o);
} else {
inventoryLayoutScreen1.Ka = inventoryLayoutScreen1.c;
inventoryLayoutScreen1.K = L(97.0F);
inventoryLayoutScreen1.L(renderContext, inventoryLayoutScreen1.L().getValue(), -1);
inventoryLayoutScreen2 = inventoryLayoutScreen1;
}
inventoryLayoutScreen2.searchField.update(renderContext);
inventoryLayoutScreen1.searchField.render(renderContext);
inventoryLayoutScreen1.D(renderContext);
if (inventoryLayoutScreen1.e != null) {
inventoryLayoutScreen1.render2D
.drawTextVCentered(
Fonts.FONT_STYLE16,
inventoryLayoutScreen1.render2D
.trimToWidth(Fonts.FONT_STYLE16, inventoryLayoutScreen1.e, Math.max(40.0F, inventoryLayoutScreen1.W - 276.0F - 16.0F - 12.0F)),
inventoryLayoutScreen1.a,
inventoryLayoutScreen1.uiButton3.D() + 15.0F,
ThemeManager.withAlpha(ThemeManager.getPalette().onSurfaceVariant(), 0.9F)
);
}
UiButton[] uiButtons;
lx = (uiButtons = inventoryLayoutScreen1.L()).length;
int mx;
for (int n = mx = 0; n < lx; n = mx) {
UiButton uiButtonx = uiButtons[mx];
mx++;
uiButtonx.update(renderContext);
uiButtonx.render(renderContext);
}
if (inventoryLayoutScreen1.Aa) {
inventoryLayoutScreen1.L(renderContext);
}
inventoryLayoutScreen1.render2D.clearScissors();
}
private void L(InventoryLayoutScreenData inventoryLayoutScreenData) {
if (inventoryLayoutScreenData.slot() >= 0) {
this.y.slots.d(inventoryLayoutScreenData.slot(), inventoryLayoutScreenData.matcher());
} else {
ItemListSetting itemListSetting;
if ((itemListSetting = this.L()) != null) {
itemListSetting.L(inventoryLayoutScreenData.matcher());
}
}
}
@Override
protected void mouseReleased(int i, int j, int k) {
UiButton[] uiButtons;
int lx = (uiButtons = this.L()).length;
int mx;
for (int n = mx = 0; n < lx; n = mx) {
UiButton uiButtonx = uiButtons[mx];
float fx = ix;
mx++;
uiButtonx.mouseReleased(fx, jx, k);
}
InventoryLayoutScreen inventoryLayoutScreen1;
label19: {
this.searchField.mouseReleased(ix, jx, k);
if (this.itemSpec != null) {
if (this.Aa) {
this.L(ix, jx);
inventoryLayoutScreen1 = this;
break label19;
}
if (this.x < 0) {
this.L(this.itemSpec);
}
}
inventoryLayoutScreen1 = this;
}
inventoryLayoutScreen1.itemSpec = null;
this.x = -1;
this.Aa = false;
super.mouseReleased(ix, jx, k);
}
private float d() {
InventoryLayoutScreen inventoryLayoutScreen1 = this;
int ix = new ScaledResolution(inventoryLayoutScreen1.mc).getScaleFactor();
return (float)(inventoryLayoutScreen1.mc.displayHeight - Minecraft.getScaledMouseY()) / ix;
}
@Override
protected void keyTyped(char c, int i) throws IOException {
KeyInput keyInput = new KeyInput(ix, 0, 0, cx);
if (!this.searchField.keyTyped(keyInput)) {
if (cx < ' ' || !this.searchField.charTyped(new CharInput(cx, 0))) {
if (ix == 1) {
this.L();
} else {
super.keyTyped(cx, ix);
}
}
}
}
private float L() {
long lx = System.nanoTime();
if (this.Ja == 0L) {
this.Ja = lx;
return 16.0F;
} else {
float fx = (float)(lx - this.Ja) / 1000000.0F;
this.Ja = lx;
return Math.min(fx, 100.0F);
}
}
private void d(RenderContext renderContext) {
InventoryLayoutScreen inventoryLayoutScreen1 = this;
float fx = 382.0F;
fx = inventoryLayoutScreen1.J + (inventoryLayoutScreen1.Ma - fx) / 2.0F;
int ix;
for (int mx = ix = 0; mx < 9; mx = ix) {
float h = fx + 43.0F * ix;
inventoryLayoutScreen1.z.add(new InventoryLayoutScreenData(h, inventoryLayoutScreen1.c, 38.0F, 38.0F, null, ix));
boolean bl = inventoryLayoutScreen1.Aa
&& renderContext.H >= h
&& renderContext.H < h + 38.0F
&& renderContext.f >= inventoryLayoutScreen1.c
&& renderContext.f < inventoryLayoutScreen1.c + 38.0F;
float gx = inventoryLayoutScreen1.animations[ix].getValue();
int jx = ThemeManager.getPalette().surfaceContainerHighest();
int k = bl ? ThemeManager.getPalette().primaryContainer() : L(jx, ThemeManager.getPalette().secondaryContainer(), gx);
inventoryLayoutScreen1.render2D.roundedRect(h, inventoryLayoutScreen1.c, 38.0F, 38.0F, 8.0F, k);
float lx;
if ((lx = Math.max(gx, bl ? 1.0F : 0.0F)) > 0.01F) {
inventoryLayoutScreen1.render2D
.roundedOutline(h, inventoryLayoutScreen1.c, 38.0F, 38.0F, 8.0F, 1.5F, ThemeManager.withAlpha(ThemeManager.getPalette().primary(), lx));
}
List list;
if (!(list = inventoryLayoutScreen1.y.slots.L(ix)).isEmpty()) {
inventoryLayoutScreen1.L(((ItemSpec)list.get(0)).L(), h + 9.0F, inventoryLayoutScreen1.c + 13.0F + 2.5F, 20.0F);
}
if (list.size() > 1) {
inventoryLayoutScreen1.render2D
.drawTextRight(
Fonts.FONT_STYLE13,
new StringBuilder().insert(0, "+").append(list.size() - 1).toString(),
h + 38.0F - 3.0F,
inventoryLayoutScreen1.c + 38.0F - 11.0F,
ThemeManager.getPalette().onSurface()
);
}
Render2D render2Dx = inventoryLayoutScreen1.render2D;
FontStyle fontStyle = Fonts.FONT_STYLE13;
String string = String.valueOf(ix + 1);
float n = h + 19.0F;
float ox = inventoryLayoutScreen1.c + 4.0F;
int p = ThemeManager.getPalette().onSurfaceVariant();
float qx = 0.4F * gx;
ix++;
render2Dx.drawTextCentered(fontStyle, string, n, ox, ThemeManager.withAlpha(p, 0.55F + qx));
}
}
@Override
protected void mouseClickMove(int i, int j, int k, long l) {
if (this.itemSpec != null && !this.Aa && (Math.abs(ix - this.la) > 3.0F || Math.abs(jx - this.t) > 3.0F)) {
this.Aa = true;
}
if (!this.Aa) {
super.mouseClickMove(ix, jx, k, lx);
}
}
private void L(ItemSpec itemSpec) {
if (itemSpecx != null) {
ItemListSetting itemListSetting;
if ((itemListSetting = this.L()) != null) {
itemListSetting.D(itemSpecx);
} else if (this.y.slots.L(this.o).contains(itemSpecx)) {
this.y.slots.d(this.o, itemSpecx);
} else {
this.y.slots.L(this.o, itemSpecx);
}
}
}
private static float L(float f) {
float gx = fx;
fx = 27.0F;
return Math.max(1, (int)((gx + 5.0F) / fx)) * fx - 5.0F;
}
private void L(ItemStack itemStack, float f, float g, float h) {
if (itemStack != null && itemStack.getItem() != null) {
this.render2D.pushMatrix();
this.render2D.translate(fx, gx);
this.render2D.scaleAround(h / 16.0F, 0.0F, 0.0F);
this.render2D.drawItem(itemStack, 0.0F, 0.0F);
this.render2D.popMatrix();
}
}
private String L() {
if (this.ja == 0) {
return "Pick a slot, then click or drag an item onto it";
} else {
return this.ja == 1 ? "Never thrown away, even if the Drop list says so" : "Thrown away when Drop junk is on";
}
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
private void L(RenderContext renderContext) {
if (this.itemSpec != null) {
this.L(this.itemSpec.L(), renderContext.H - 6.5F, renderContext.f - 6.5F, 13.0F);
}
}
private float L(ItemSpec itemSpec) {
return 33.0F + this.render2D.getTextWidth(Fonts.FONT_STYLE16, this.L(itemSpecx)) + 4.0F + 9.0F;
}
private void L(ItemSpec itemSpec, int i, float f, float g) {
this.itemSpec = itemSpecx;
this.x = ix;
this.la = fx;
this.t = gx;
this.Aa = false;
}
private boolean L(ItemSpec itemSpec) {
InventoryLayoutScreen inventoryLayoutScreen1 = this;
ItemListSetting itemListSetting;
return (itemListSetting = inventoryLayoutScreen1.L()) == null
? inventoryLayoutScreen1.y.slots.L(inventoryLayoutScreen1.o).contains(itemSpecx)
: itemListSetting.L(itemSpecx);
}
private float L(RenderContext renderContext, float f) {
InventoryLayoutScreen inventoryLayoutScreen1 = this;
float h = inventoryLayoutScreen1.a;
fx = fx;
ItemSpecMode[] itemSpecModes;
int ix = (itemSpecModes = ItemSpecMode.values()).length;
int jx;
for (int lx = jx = 0; lx < ix; lx = jx) {
ItemSpec itemSpecx = ItemSpec.L(itemSpecModes[jx]);
float gx = inventoryLayoutScreen1.L(itemSpecx);
if (h + gx > inventoryLayoutScreen1.a + inventoryLayoutScreen1.W - 7.0F && h > inventoryLayoutScreen1.a) {
h = inventoryLayoutScreen1.a;
fx += 27.0F;
}
boolean bl = inventoryLayoutScreen1.L(itemSpecx);
boolean bl1 = renderContext.H >= h
&& renderContext.H < h + gx
&& renderContext.f >= fx
&& renderContext.f < fx + 22.0F
&& renderContext.f >= inventoryLayoutScreen1.Y
&& renderContext.f < inventoryLayoutScreen1.j;
int k = bl
? ThemeManager.getPalette().primaryContainer()
: (bl1 ? ThemeManager.getPalette().surfaceContainerHighest() : ThemeManager.getPalette().surfaceContainerHigh());
inventoryLayoutScreen1.render2D.roundedRect(h, fx, gx, 22.0F, Float.MAX_VALUE, k);
inventoryLayoutScreen1.L(itemSpecx.L(), h + 8.0F, fx + 4.5F, 13.0F);
inventoryLayoutScreen1.render2D
.drawTextVCentered(
Fonts.FONT_STYLE16,
inventoryLayoutScreen1.L(itemSpecx),
h + 8.0F + 13.0F + 4.0F,
fx + 11.0F,
bl ? ThemeManager.getPalette().onPrimaryContainer() : ThemeManager.getPalette().onSurface()
);
if (bl) {
MaterialIcons.d(inventoryLayoutScreen1.render2D, h + gx - 8.0F - 4.5F, fx + 11.0F, 11.0F, ThemeManager.getPalette().onPrimaryContainer());
}
inventoryLayoutScreen1.inventoryLayoutScreenDatas2.add(new InventoryLayoutScreenData(h, fx, gx, 22.0F, itemSpecx, -1));
jx++;
h += gx + 5.0F;
}
return fx + 22.0F;
}
@Override
protected void mouseClicked(int i, int j, int k) throws IOException {
InventoryLayoutScreen inventoryLayoutScreen1 = this;
UiButton[] uiButtons;
int mx = (uiButtons = inventoryLayoutScreen1.L()).length;
int lx;
for (int n = lx = 0; n < mx; n = ++lx) {
if (uiButtons[lx].mouseClicked(ix, jx, k)) {
return;
}
}
if (!inventoryLayoutScreen1.segmentedControl.mouseClicked(ix, jx, k)) {
if (!inventoryLayoutScreen1.searchField.mouseClicked(ix, jx, k)) {
if (k != 0) {
inventoryLayoutScreen1.mouseClicked(ix, jx, k);
} else {
for (Iterator iterator4 = iterator = inventoryLayoutScreen1.z.iterator(); iterator4.hasNext(); iterator4 = iterator) {
InventoryLayoutScreenData inventoryLayoutScreenData;
if ((inventoryLayoutScreenData = (InventoryLayoutScreenData)iterator.next()).L(ix, jx)) {
inventoryLayoutScreen1.d(inventoryLayoutScreenData.slot());
return;
}
}
for (Iterator iterator5 = iterator1 = inventoryLayoutScreen1.inventoryLayoutScreenDatas3.iterator(); iterator5.hasNext(); iterator5 = iterator1) {
InventoryLayoutScreenData inventoryLayoutScreenData1;
if ((inventoryLayoutScreenData1 = (InventoryLayoutScreenData)iterator1.next()).L(ix, jx)) {
if (ix >= inventoryLayoutScreenData1.x() + inventoryLayoutScreenData1.width() - 8.0F - 9.0F - 2.0F) {
inventoryLayoutScreen1.L(inventoryLayoutScreenData1);
return;
}
inventoryLayoutScreen1.L(inventoryLayoutScreenData1.matcher(), inventoryLayoutScreenData1.slot(), ix, jx);
return;
}
}
if (jx >= inventoryLayoutScreen1.Y && jx < inventoryLayoutScreen1.j) {
for (Iterator iterator6 = iterator2 = inventoryLayoutScreen1.inventoryLayoutScreenDatas2.iterator();
iterator6.hasNext();
iterator6 = iterator2
) {
InventoryLayoutScreenData inventoryLayoutScreenData2;
if ((inventoryLayoutScreenData2 = (InventoryLayoutScreenData)iterator2.next()).L(ix, jx)) {
inventoryLayoutScreen1.L(inventoryLayoutScreenData2.matcher(), -1, ix, jx);
return;
}
}
for (Iterator iterator7 = iterator3 = inventoryLayoutScreen1.inventoryLayoutScreenDatas.iterator();
iterator7.hasNext();
iterator7 = iterator3
) {
InventoryLayoutScreenData inventoryLayoutScreenData3;
if ((inventoryLayoutScreenData3 = (InventoryLayoutScreenData)iterator3.next()).L(ix, jx)) {
inventoryLayoutScreen1.L(inventoryLayoutScreenData3.matcher(), -1, ix, jx);
return;
}
}
}
inventoryLayoutScreen1.mouseClicked(ix, jx, k);
}
}
}
}
private void L(RenderContext renderContext, List<ItemSpec> list, int i) {
InventoryLayoutScreen inventoryLayoutScreen1 = this;
if (list.isEmpty()) {
inventoryLayoutScreen1.v = 0.0F;
inventoryLayoutScreen1.m = 0.0F;
inventoryLayoutScreen1.render2D
.drawText(
Fonts.FONT_STYLE2,
inventoryLayoutScreen1.d(),
inventoryLayoutScreen1.a,
inventoryLayoutScreen1.Ka + 4.0F,
ThemeManager.withAlpha(ThemeManager.getPalette().onSurfaceVariant(), 0.6F)
);
} else {
inventoryLayoutScreen1.render2D.pushScissor(inventoryLayoutScreen1.a, inventoryLayoutScreen1.Ka, inventoryLayoutScreen1.W, inventoryLayoutScreen1.K);
float fx = inventoryLayoutScreen1.a;
float h = inventoryLayoutScreen1.Ka - inventoryLayoutScreen1.m;
for (Iterator iterator1 = iterator = list.iterator(); iterator1.hasNext(); iterator1 = iterator) {
ItemSpec itemSpecx = (ItemSpec)iterator.next();
float gx = inventoryLayoutScreen1.L(itemSpecx);
if (fx + gx > inventoryLayoutScreen1.a + inventoryLayoutScreen1.W - 7.0F && fx > inventoryLayoutScreen1.a) {
fx = inventoryLayoutScreen1.a;
h += 27.0F;
}
if (h + 22.0F >= inventoryLayoutScreen1.Ka && h < inventoryLayoutScreen1.Ka + inventoryLayoutScreen1.K) {
boolean bl = renderContext.H >= fx && renderContext.H < fx + gx && renderContext.f >= h && renderContext.f < h + 22.0F;
inventoryLayoutScreen1.render2D
.roundedRect(
fx,
h,
gx,
22.0F,
Float.MAX_VALUE,
bl ? ThemeManager.getPalette().secondaryContainer() : ThemeManager.getPalette().surfaceContainerHighest()
);
inventoryLayoutScreen1.L(itemSpecx.L(), fx + 8.0F, h + 4.5F, 13.0F);
inventoryLayoutScreen1.render2D
.drawTextVCentered(
Fonts.FONT_STYLE16, inventoryLayoutScreen1.L(itemSpecx), fx + 8.0F + 13.0F + 4.0F, h + 11.0F, ThemeManager.getPalette().onSurface()
);
MaterialIcons.D(
inventoryLayoutScreen1.render2D,
fx + gx - 8.0F - 4.5F,
h + 11.0F,
9.0F,
ThemeManager.withAlpha(ThemeManager.getPalette().onSurfaceVariant(), bl ? 1.0F : 0.7F)
);
inventoryLayoutScreen1.inventoryLayoutScreenDatas3.add(new InventoryLayoutScreenData(fx, h, gx, 22.0F, itemSpecx, ix));
}
fx += gx + 5.0F;
}
inventoryLayoutScreen1.render2D.popScissor();
inventoryLayoutScreen1.v = Math.max(0.0F, h + 22.0F + inventoryLayoutScreen1.m - (inventoryLayoutScreen1.Ka + inventoryLayoutScreen1.K));
inventoryLayoutScreen1.m = Math.min(inventoryLayoutScreen1.m, inventoryLayoutScreen1.v);
inventoryLayoutScreen1.L(inventoryLayoutScreen1.Ka, inventoryLayoutScreen1.K, inventoryLayoutScreen1.m, inventoryLayoutScreen1.v);
}
}
@Override
public void onGuiClosed() {
Keyboard.enableRepeatEvents(false);
TextInput.D();
}
private UiButton[] L() {
UiButton[] uiButtons = new UiButton[3];
boolean bl = true;
uiButtons[0] = this.uiButton3;
uiButtons[1] = this.uiButton;
uiButtons[2] = this.uiButton2;
return uiButtons;
}
}
@@ -0,0 +1,9 @@
package openonyx.ui;
import openonyx.utilities.ItemSpec;
record InventoryLayoutScreenData(float x, float y, float width, float height, ItemSpec matcher, int slot) {
boolean L(float f, float g) {
return f >= this.x && f < this.x + this.width && g >= this.y && g < this.y + this.height;
}
}
+92
View File
@@ -0,0 +1,92 @@
package openonyx.ui;
import openonyx.input.CharInput;
import openonyx.input.KeyInput;
public final class KeyShortcuts {
public static boolean k(KeyInput keyInput) {
return d(keyInput, 49);
}
public static boolean F(KeyInput keyInput) {
return keyInput.D() || keyInput.i();
}
public static boolean L(CharInput charInput) {
CharInput charInput1 = charInput;
int i;
return (i = charInput1.codepoint()) >= 32 && i != 127 && Character.isDefined(i);
}
public static boolean l(KeyInput keyInput) {
return keyInput.key() == 14 && !F(keyInput) && !keyInput.L();
}
public static boolean h(KeyInput keyInput) {
return F(keyInput) || keyInput.L();
}
public static boolean d(KeyInput keyInput, int i) {
return keyInput.key() == i && F(keyInput) && !keyInput.d() && !keyInput.L();
}
public static boolean I(KeyInput keyInput) {
return d(keyInput, 33);
}
public static boolean i(KeyInput keyInput) {
return d(keyInput, 31);
}
public static String decrypt(String string) {
String string1 = string;
int o = --5 << 3 ^ 6;
int p = 4 << 4 ^ 14;
int q = 4 << 4;
String string2;
int r = (string2 = string1).length();
char[] d = new char[r];
boolean bl = true;
int k;
int m = k = r - 1;
char[] c = d;
int j = q;
int l = m;
int i = o;
while (l >= 0) {
p = k;
int n = string2.charAt(k);
k--;
c[p] = (char)(n ^ i);
if (k < 0) {
break;
}
n = k--;
c[n] = (char)(string2.charAt(n) ^ j);
l = k;
}
return new String(c);
}
public static boolean D(KeyInput keyInput) {
return d(keyInput, 44);
}
public static boolean d(KeyInput keyInput) {
return keyInput.key() == 28 || keyInput.key() == 156;
}
public static boolean L(KeyInput keyInput) {
return d(keyInput, 21) || L(keyInput, 44);
}
public static boolean L(KeyInput keyInput, int i) {
return keyInput.key() == i && F(keyInput) && keyInput.d() && !keyInput.L();
}
private KeyShortcuts() {
}
}
+152
View File
@@ -0,0 +1,152 @@
package openonyx.ui;
import openonyx.features.ModuleCategory;
import openonyx.features.hud.StatsMode;
import openonyx.render.Render2D;
public final class MaterialIcons {
public static final String u = "\ue566";
public static final String y = "\ue5c4";
public static final String n = "\ue87d";
public static final String Y = "\ue7fe";
public static final String r = "\ue640";
public static final String W = "\ue7fd";
public static final String P = "\ue9e0";
public static final String V = "\ue5d5";
public static final String R = "\ue8f4";
public static final String p = "\ue5cd";
public static final String t = "\ue8b6";
public static final String b = "\ue5ca";
public static final String E = "\uea77";
public static final String F = "\ue001";
public static final String G = "\ue9ba";
private static final float A = 0.06F;
public static final String K = "\ue8b8";
public static final String B = "\ue14d";
public static final String C = "\ue872";
public static final String J = "\ue7f4";
public static final String D = "\ue73c";
public static final String c = "\ue161";
public static final String a = "\uea4b";
public static final String k = "\ue88e";
public static final String g = "\ue875";
public static final String M = "\ue405";
public static final String L = "\ue002";
public static final String j = "\ue871";
public static final String m = "\ue145";
public static final String h = "\ue2c4";
public static final String l = "\ue2c8";
public static final String I = "\ue5d4";
public static final String d = "\ue9e4";
public static final String i = "\ue5cf";
public static final String f = "\ue202";
public static final String H = "\ue89e";
public static final String e = "\ue312";
public static void I(Render2D render2D, float f, float g, float h, int i) {
render2D.drawIcon("\ue5c4", fx, gx, hx, ix);
}
public static void i(Render2D render2D, float f, float g, float h, int i) {
render2D.drawIcon("\ue5cf", fx, gx, hx, ix);
}
public static void D(Render2D render2D, float f, float g, float h, int i) {
render2D.drawIcon("\ue5cd", fx, gx, hx, ix);
}
public static void L(Render2D render2D, StatsMode statsMode, float f, float g, float h, int i) {
render2D.drawIcon(L(statsMode), fx, gx, hx, ix);
}
// $VF: Unable to simplify switch on enum
// Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!)
private static String L(StatsMode statsMode) {
switch (statsMode) {
case FPS:
while (false) {
}
return "\ue9e4";
case USERNAME:
return "\ue7fd";
case PING:
return "\ue640";
case PACKET_LOSS:
return "\ue202";
case SERVER:
return "\ue875";
default:
throw new MatchException(null, null);
}
}
public static void d(Render2D render2D, float f, float g, float h, int i) {
render2D.drawIcon("\ue5ca", fx, gx, hx, ix, hx * 0.06F);
}
// $VF: Unable to simplify switch on enum
// Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!)
private static String L(ModuleCategory moduleCategory) {
switch (moduleCategory) {
case COMBAT:
while (false) {
}
return "\ue9e0";
case MOVEMENT:
return "\ue566";
case PLAYER:
return "\ue7fd";
case RENDER:
return "\ue8f4";
case HUD:
return "\ue871";
default:
throw new MatchException(null, null);
}
}
public static void L(Render2D render2D, ModuleCategory moduleCategory, float f, float g, float h, int i) {
render2D.drawIcon(L(moduleCategory), fx, gx, hx, ix);
}
private MaterialIcons() {
}
public static String decrypt(String string) {
String string1 = string;
int mx = --4 << 3 ^ 7;
int nx = 3 << 3 ^ 3;
String string2;
int px = (string2 = string1).length();
char[] dx = new char[px];
boolean bl = true;
int jx;
int o = jx = px - 1;
char[] cx = dx;
byte bx = 58;
int kx = o;
int ix = mx;
while (kx >= 0) {
nx = jx;
int lx = string2.charAt(jx);
jx--;
cx[nx] = (char)(lx ^ ix);
if (jx < 0) {
break;
}
lx = jx--;
cx[lx] = (char)(string2.charAt(lx) ^ bx);
kx = jx;
}
return new String(cx);
}
public static void L(Render2D render2D, float f, float g, float h, int i) {
render2D.drawIcon("\ue8b6", fx, gx, hx, ix);
}
}
+67
View File
@@ -0,0 +1,67 @@
package openonyx.ui;
import openonyx.features.ModuleCategory;
import openonyx.features.hud.StatsMode;
// $VF: synthetic class
class MaterialIconsPart {
static {
int[] i = new int[StatsMode.values().length];
boolean bl = true;
e = i;
try {
e[StatsMode.FPS.ordinal()] = 1;
} catch (NoSuchFieldError noSuchFieldError9) {
}
try {
e[StatsMode.USERNAME.ordinal()] = 2;
} catch (NoSuchFieldError noSuchFieldError8) {
}
try {
e[StatsMode.PING.ordinal()] = 3;
} catch (NoSuchFieldError noSuchFieldError7) {
}
try {
e[StatsMode.PACKET_LOSS.ordinal()] = 4;
} catch (NoSuchFieldError noSuchFieldError6) {
}
try {
e[StatsMode.SERVER.ordinal()] = 5;
} catch (NoSuchFieldError noSuchFieldError5) {
}
i = new int[ModuleCategory.values().length];
bl = true;
H = i;
try {
H[ModuleCategory.COMBAT.ordinal()] = 1;
} catch (NoSuchFieldError noSuchFieldError4) {
}
try {
H[ModuleCategory.MOVEMENT.ordinal()] = 2;
} catch (NoSuchFieldError noSuchFieldError3) {
}
try {
H[ModuleCategory.PLAYER.ordinal()] = 3;
} catch (NoSuchFieldError noSuchFieldError2) {
}
try {
H[ModuleCategory.RENDER.ordinal()] = 4;
} catch (NoSuchFieldError noSuchFieldError1) {
}
try {
H[ModuleCategory.HUD.ordinal()] = 5;
} catch (NoSuchFieldError noSuchFieldError) {
}
}
}