Various Mixin-related Fixes (#890)

* Update deps

* Remove dead code

* Add missing `@Override` annotations

* Fix generics

* Add `serialVersionUID`s

* Address deprecation warnings

* Use `@WrapWithCondition` v2

* Misc cleanup

* Use AccessTransformers if possible

* Fix mixin conflicts

* Add `@Mutable` annotations

* Fix injection targets

* Update deps
This commit is contained in:
glowredman authored and GitHub committed 2025-03-08 20:41:47 -08:00
1 parent 611bbf02c8
commit bb5526598e
158 files changed
+252 -619

No files matched your search

@@ -2,23 +2,18 @@ package net.coderbot.iris.gui;
import lombok.Getter;
import net.coderbot.iris.gui.element.ShaderPackOptionList;
import net.coderbot.iris.shaderpack.option.menu.OptionMenuContainer;
import java.util.ArrayDeque;
import java.util.Deque;
public class NavigationController {
private final OptionMenuContainer container;
private ShaderPackOptionList optionList;
@Getter
private String currentScreen = null;
private final Deque<String> history = new ArrayDeque<>();
public NavigationController(OptionMenuContainer container) {
this.container = container;
}
public void back() {
if (history.size() > 0) {
history.removeLast();
@@ -153,7 +153,8 @@ public class IrisElementRow {
this.onClick = onClick;
}
@Override
@SuppressWarnings("unchecked")
@Override
public boolean mouseClicked(double mx, double my, int button) {
if (this.disabled) {
return false;
@@ -67,7 +67,7 @@ public class ShaderPackOptionList extends IrisGuiSlot {
row.add(element);
if (row.size() >= columns) {
this.addEntry(new ElementRowEntry(screen, this.navigation, row));
this.addEntry(new ElementRowEntry(this.navigation, row));
row = new ArrayList<>(); // Clearing the list would affect the row entry created above
}
}
@@ -77,7 +77,7 @@ public class ShaderPackOptionList extends IrisGuiSlot {
row.add(AbstractElementWidget.EMPTY);
}
this.addEntry(new ElementRowEntry(screen, this.navigation, row));
this.addEntry(new ElementRowEntry(this.navigation, row));
}
}
@@ -81,7 +81,7 @@ public class ShaderPackSelectionList extends IrisGuiSlot {
}
public void addPackEntry(int index, String name) {
final ShaderPackEntry entry = new ShaderPackEntry(index, this, name);
final ShaderPackEntry entry = new ShaderPackEntry(this, name);
Iris.getIrisConfig().getShaderPackName().ifPresent(currentPackName -> {
if (name.equals(currentPackName)) {
@@ -11,15 +11,12 @@ import java.util.List;
public class ElementRowEntry extends BaseEntry {
private final List<AbstractElementWidget<?>> widgets;
private final ShaderPackScreen screen;
private int cachedWidth;
private int cachedPosX;
public ElementRowEntry(ShaderPackScreen screen, NavigationController navigation, List<AbstractElementWidget<?>> widgets) {
public ElementRowEntry(NavigationController navigation, List<AbstractElementWidget<?>> widgets) {
super(navigation);
this.screen = screen;
this.widgets = widgets;
}
@@ -51,10 +48,12 @@ public class ElementRowEntry extends BaseEntry {
return MathHelper.clamp_int((int) Math.floor(widgets.size() * positionAcrossWidget), 0, widgets.size() - 1);
}
@Override
public boolean mouseClicked(int mouseX, int mouseY, int button) {
return this.widgets.get(getHoveredWidget(mouseX)).mouseClicked(mouseX, mouseY, button);
}
@Override
public boolean mouseReleased(int mouseX, int mouseY, int button) {
return this.widgets.get(getHoveredWidget(mouseX)).mouseReleased(mouseX, mouseY, button);
}
@@ -58,6 +58,7 @@ public class HeaderEntry extends BaseEntry {
this.text = text;
}
@Override
public void drawEntry(ShaderPackScreen screen, int index, int x, int y, int slotWidth, int slotHeight, Tessellator tessellator, int mouseX, int mouseY, boolean isMouseOver) {
// Draw dividing line
// fill(x - 3, (y + slotHeight) - 2, x + slotWidth, (y + slotHeight) - 1, 0x66BEBEBE);
@@ -101,6 +102,7 @@ public class HeaderEntry extends BaseEntry {
ShaderPackScreen.TOP_LAYER_RENDER_QUEUE.add(() -> GuiUtil.drawTextPanel(font, text, x - (font.getStringWidth(text) + 10), y - 16));
}
@Override
public boolean mouseClicked(int mouseX, int mouseY, int button) {
final boolean backButtonResult = backButton != null && backButton.mouseClicked(mouseX, mouseY, button);
final boolean utilButtonResult = utilityButtons.mouseClicked(mouseX, mouseY, button);
@@ -10,13 +10,11 @@ import net.minecraft.util.EnumChatFormatting;
public class ShaderPackEntry extends BaseEntry {
@Getter private final String packName;
private final ShaderPackSelectionList shaderPackSelectionList;
private final int index;
public ShaderPackEntry(int index, ShaderPackSelectionList list, String packName) {
public ShaderPackEntry(ShaderPackSelectionList list, String packName) {
super(list);
this.packName = packName;
this.shaderPackSelectionList = list;
this.index = index;
}
public boolean isApplied() {
@@ -55,6 +55,7 @@ public class TopButtonRowEntry extends BaseEntry {
this.shaderPackSelectionList.getScreen().refreshScreenSwitchButton();
}
@Override
public void drawEntry(ShaderPackScreen screen, int index, int x, int y, int listWidth, Tessellator tessellator, int mouseX, int mouseY, boolean isMouseOver) {
this.buttons.setWidth(this.enableDisableButton, (listWidth - 1) - REFRESH_BUTTON_WIDTH);
this.enableDisableButton.centerX = x + (int)(listWidth * 0.5);
@@ -3,7 +3,6 @@ package net.coderbot.iris.gui.element.widget;
import net.minecraft.client.gui.GuiButton;
import java.util.function.Consumer;
import java.util.function.Function;
public class IrisButton extends GuiButton {
protected final Consumer<IrisButton> onPress;
@@ -1,11 +1,6 @@
package net.coderbot.iris.gui.option;
import java.io.IOException;
import net.coderbot.iris.Iris;
import net.coderbot.iris.pipeline.WorldRenderingPipeline;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
public class IrisVideoSettings {
public static int shadowDistance = 32;
@@ -22,7 +22,6 @@ import org.lwjgl.Sys;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
@@ -66,7 +65,6 @@ public class ShaderPackScreen extends GuiScreen implements HudHideable {
private boolean optionMenuOpen = false;
private boolean dropChanges = false;
private static final String development = "Development Environment";
private String developmentComponent;
private String updateComponent;
@@ -235,10 +233,6 @@ public class ShaderPackScreen extends GuiScreen implements HudHideable {
}
if (inWorld) {
final String showOrHide = this.guiHidden
? I18n.format("options.iris.gui.show")
: I18n.format("options.iris.gui.hide");
final float endOfLastButton = this.width / 2.0f + 154.0f;
final float freeSpace = this.width - endOfLastButton;
final int x;
@@ -320,7 +314,7 @@ public class ShaderPackScreen extends GuiScreen implements HudHideable {
if (Iris.getCurrentPack().isPresent()) {
final ShaderPack currentPack = Iris.getCurrentPack().get();
this.navigation = new NavigationController(currentPack.getMenuContainer());
this.navigation = new NavigationController();
if (this.shaderOptionList != null) {
this.shaderOptionList.applyShaderPack(currentPack);