From 11636b34b886536722b47b5925745bb61bb4970a Mon Sep 17 00:00:00 2001 From: Toni Date: Sun, 26 May 2024 15:38:28 -0400 Subject: [PATCH] fix merge conflicts --- README.md | 2 - .../client/gui/SodiumGameOptionPages.java | 1 + .../sodium/client/gui/SodiumOptionsGUI.java | 4 +- .../client/gui/widgets/FlatButtonWidget.java | 7 +- .../mods/sodium/client/util/Dim2i.java | 141 +++++++++++++++++- .../resources/assets/sodium/lang/en_us.json | 2 +- 6 files changed, 143 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 9838199f..68b51b01 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,6 @@ Discord. You can report issues on the [Xenon GitHub](https://github.com/anthxnym Xenon will work with everything Embeddium does, as it is a fork. We intend to keep compatibility with upstream and Embeddium / Forge Sodium addons as much as possible. -If you're looking to add Embeddium to your development environment, please take a look at the [dedicated wiki page](https://github.com/embeddedt/embeddium/wiki/For-Developers) for instructions & recommended guidelines for integration. - For now, please continue to use [Oculus](https://www.curseforge.com/minecraft/mc-mods/oculus) if you want shader support. If you encounter issues with shaders installed, disable Oculus first, and if that fixes it, report the issue to them instead. diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptionPages.java b/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptionPages.java index 57cf6343..e981f006 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptionPages.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptionPages.java @@ -2,6 +2,7 @@ import com.google.common.collect.ImmutableList; import com.mojang.blaze3d.pipeline.RenderTarget; +import com.mojang.blaze3d.platform.Window; import me.jellysquid.mods.sodium.client.compat.modernui.MuiGuiScaleHook; import me.jellysquid.mods.sodium.client.compatibility.workarounds.Workarounds; import me.jellysquid.mods.sodium.client.gl.arena.staging.MappedStagingBuffer; diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumOptionsGUI.java b/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumOptionsGUI.java index f01af1e1..6bd55a36 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumOptionsGUI.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumOptionsGUI.java @@ -52,7 +52,7 @@ public class SodiumOptionsGUI extends Screen implements ScreenPromptable { // Donation prompt should not be shown with Controllable present (as it's impossible to exit) or in a dev env. private static final boolean IS_POPUP_SAFE = !PlatformUtil.modPresent("controllable") && !PlatformUtil.isDevelopmentEnvironment(); - private final List pages = new ArrayList<>(); + public final List pages = new ArrayList<>(); private final List> controls = new ArrayList<>(); @@ -71,7 +71,7 @@ public class SodiumOptionsGUI extends Screen implements ScreenPromptable { private boolean forceOldScreen; public SodiumOptionsGUI(Screen prevScreen) { - super(Component.literal(MODNAME + " Options")); + super(Component.translatable(MODNAME + " Options")); this.prevScreen = prevScreen; diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gui/widgets/FlatButtonWidget.java b/src/main/java/me/jellysquid/mods/sodium/client/gui/widgets/FlatButtonWidget.java index 356d3fd3..8adbbb44 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gui/widgets/FlatButtonWidget.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gui/widgets/FlatButtonWidget.java @@ -1,5 +1,6 @@ package me.jellysquid.mods.sodium.client.gui.widgets; +import me.jellysquid.mods.sodium.client.gui.reesesoptions.client.gui.FlatButtonWidgetExtended; import me.jellysquid.mods.sodium.client.util.Dim2i; import net.minecraft.client.gui.ComponentPath; import net.minecraft.client.gui.GuiGraphics; @@ -14,7 +15,7 @@ import java.util.Objects; -public class FlatButtonWidget extends AbstractWidget implements Renderable { +public class FlatButtonWidget extends AbstractWidget implements Renderable, FlatButtonWidgetExtended { protected final Dim2i dim; private final Runnable action; @@ -172,4 +173,8 @@ public static Style defaults() { } } + @Override + public boolean isLeftAligned() { + return this.leftAligned; + } } diff --git a/src/main/java/me/jellysquid/mods/sodium/client/util/Dim2i.java b/src/main/java/me/jellysquid/mods/sodium/client/util/Dim2i.java index f051a2ab..c9b16483 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/util/Dim2i.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/util/Dim2i.java @@ -1,8 +1,24 @@ package me.jellysquid.mods.sodium.client.util; -public record Dim2i(int x, int y, int width, int height) implements Point2i { - public int getLimitX() { - return this.x + this.width; +import me.jellysquid.mods.sodium.client.gui.reesesoptions.client.gui.Dim2iExtended; +import me.jellysquid.mods.sodium.client.gui.reesesoptions.client.gui.Point2i; + +import java.util.Objects; + +public final class Dim2i implements Dim2iExtended, Point2i +{ + private Point2i point2i; + private int x; + private int y; + private int width; + private int height; + + public Dim2i(int x, int y, int width, int height) + { + this.x = x; + this.y = y; + this.width = width; + this.height = height; } public int getLimitX() @@ -25,6 +41,119 @@ public int getCenterX() return (this.x() + this.width() / 2); } + public int getCenterY() + { + return (this.y() + this.height() / 2); + } + + public Point2i point2i() + { + return point2i; + } + + public int x() + { + if (this.point2i != null) { + return (this.x + this.point2i.getX()); + } + + return x; + } + + public int y() + { + if (this.point2i != null) { + return (this.y + this.point2i.getY()); + } + + return y; + } + + public int width() + { + return width; + } + + public int height() + { + return height; + } + + @Override + public boolean equals(Object obj) + { + if (obj == this) return true; + if (obj == null || obj.getClass() != this.getClass()) return false; + var that = (Dim2i) obj; + return Objects.equals(this.point2i, that.point2i) && + this.x == that.x && + this.y == that.y && + this.width == that.width && + this.height == that.height; + } + + @Override + public int hashCode() + { + return Objects.hash(point2i, x, y, width, height); + } + + @Override + public String toString() + { + return "Dim2i[" + + "point2i=" + point2i + ", " + + "x=" + x + ", " + + "y=" + y + ", " + + "width=" + width + ", " + + "height=" + height + ']'; + } + + @Override + public void setPoint2i(Point2i point2i) { + this.point2i = point2i; + } + + @Override + public void setX(int x) { + this.x = x; + } + + @Override + public void setY(int y) { + this.y = y; + } + + @Override + public void setWidth(int width) { + this.width = width; + } + + @Override + public void setHeight(int height) { + this.height = height; + } + + @Override + public int getX() { + return this.x(); + } + + @Override + public int getY() { + return this.y(); + } + + @Override + public boolean canFitDimension(Dim2i anotherDim) { + return this.x() <= anotherDim.x() && this.y() <= anotherDim.y() && this.getLimitX() >= anotherDim.getLimitX() && this.getLimitY() >= anotherDim.getLimitY(); + } + + @Override + public boolean overlapWith(Dim2i other) { + return this.x() < other.getLimitX() && this.getLimitX() > other.x() && this.y() < other.getLimitY() && this.getLimitY() > other.y(); + } + public Dim2i withHeight(int newHeight) { return new Dim2i(x, y, width, newHeight); } @@ -41,15 +170,11 @@ public Dim2i withY(int newY) { return new Dim2i(x, newY, width, height); } - public boolean canFitDimension(Dim2i anotherDim) { - return this.x() <= anotherDim.x() && this.y() <= anotherDim.y() && this.getLimitX() >= anotherDim.getLimitX() && this.getLimitY() >= anotherDim.getLimitY(); - } - public boolean overlapsWith(Dim2i other) { return this.x() < other.getLimitX() && this.getLimitX() > other.x() && this.y() < other.getLimitY() && this.getLimitY() > other.y(); } public Dim2i withParentOffset(Point2i parent) { - return new Dim2i(parent.x() + x, parent.y() + y, width, height); + return new Dim2i(parent.getX() + x, parent.getY() + y, width, height); } } diff --git a/src/main/resources/assets/sodium/lang/en_us.json b/src/main/resources/assets/sodium/lang/en_us.json index 12777d6d..732a1029 100644 --- a/src/main/resources/assets/sodium/lang/en_us.json +++ b/src/main/resources/assets/sodium/lang/en_us.json @@ -216,7 +216,7 @@ "options.leaf_culling.none": "None", "options.leaf_culling.hollow": "Hollow", "options.leaf_culling.solid": "Solid", - "options.leaf_culling.solid_aggressive": "Solid Aggressive" + "options.leaf_culling.solid_aggressive": "Solid Aggressive", "sodium.console.broken_nvidia_driver": "Your NVIDIA graphics drivers are out of date!\n * This will cause severe performance issues and crashes when Embeddium is installed.\n * Please update your graphics drivers to the latest version (version 536.23 or newer.)", "sodium.console.pojav_launcher": "PojavLauncher is not supported when using Embeddium.\n * You are very likely to run into extreme performance issues, graphical bugs, and crashes.\n * You will be on your own if you decide to continue -- we will not help you with any bugs or crashes!", "sodium.console.core_shaders_error": "The following resource packs are incompatible with Embeddium:",