Fixed sodium light bug

This commit is contained in:
2025-04-04 02:38:27 +02:00
parent 7e04120fa2
commit 48bf48fd56
2 changed files with 51 additions and 43 deletions
@@ -5,7 +5,6 @@ import java.util.function.Consumer;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.util.math.MathHelper;
import org.lwjgl.opengl.GL11;
import org.saturnclient.saturnclient.SaturnClient;
import org.saturnclient.ui.SaturnUi;
import org.saturnclient.ui.SaturnWidget;
@@ -42,10 +41,6 @@ public class SaturnButton extends SaturnWidget {
if (background) {
RenderSystem.setShaderTexture(0, Textures.BUTTON);
RenderSystem.texParameter(
GL11.GL_TEXTURE_2D,
GL11.GL_TEXTURE_MIN_FILTER,
GL11.GL_LINEAR_MIPMAP_LINEAR);
SaturnUi.drawHighResGuiTexture(
context,
@@ -5,8 +5,13 @@ import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.util.Identifier;
import org.saturnclient.saturnclient.SaturnClient;
import org.saturnclient.ui.SaturnUi;
import org.saturnclient.ui.SaturnWidget;
import org.saturnclient.ui.Textures;
public class SaturnImageButton extends SaturnButton {
import com.mojang.blaze3d.systems.RenderSystem;
public class SaturnImageButton extends SaturnWidget {
public Identifier sprite;
public int imageWidth;
@@ -17,9 +22,7 @@ public class SaturnImageButton extends SaturnButton {
Identifier sprite,
int imageWidth,
int imageHeight,
Consumer<SaturnImageButton> onPress
) {
super("", _o -> {});
Consumer<SaturnImageButton> onPress) {
this.sprite = sprite;
this.imageWidth = imageWidth;
this.imageHeight = imageHeight;
@@ -30,8 +33,7 @@ public class SaturnImageButton extends SaturnButton {
Identifier sprite,
int imageWidth,
int imageHeight,
Runnable onPress
) {
Runnable onPress) {
this(sprite, imageWidth, imageHeight, _o -> {
onPress.run();
});
@@ -42,13 +44,30 @@ public class SaturnImageButton extends SaturnButton {
DrawContext context,
boolean hovering,
int mouseX,
int mouseY
) {
super.render(context, hovering, mouseX, mouseY);
int hoverColor =
((int) (alpha * 255) << 24) |
int mouseY) {
int hoverColor = ((int) (alpha * 255) << 24) |
(SaturnClient.COLOR.value & 0x00FFFFFF);
RenderSystem.setShaderTexture(0, Textures.BUTTON);
SaturnUi.drawHighResGuiTexture(
context,
Textures.BUTTON,
0,
0,
this.width,
this.height,
SaturnClient.getWhite(this.alpha));
if (hovering) {
SaturnUi.drawHighResGuiTexture(
context,
Textures.BUTTON_BORDER,
0,
0,
this.width,
this.height,
hoverColor);
}
context.drawTexture(
RenderLayer::getGuiTextured,
@@ -61,17 +80,11 @@ public class SaturnImageButton extends SaturnButton {
imageHeight,
imageWidth,
imageHeight,
hovering ? hoverColor : SaturnClient.getWhite(alpha)
);
hovering ? hoverColor : SaturnClient.getWhite(alpha));
}
@Override
public void click(int mouseX, int mouseY) {
this.onPress.accept(this);
}
public SaturnImageButton setBackground(boolean background) {
this.background = background;
return this;
}
}