Build for Minecraft 26.2 and fix the glass blur on 26.x #51
@@ -18,7 +18,7 @@
|
|||||||
Saturn Client is a free, open-source Minecraft client designed to enhance the gameplay experience while staying lightweight and customizable.
|
Saturn Client is a free, open-source Minecraft client designed to enhance the gameplay experience while staying lightweight and customizable.
|
||||||
Our goal is to build a clean, optimized client that the community can contribute to and improve together.
|
Our goal is to build a clean, optimized client that the community can contribute to and improve together.
|
||||||
|
|
||||||
Saturn runs on Fabric and supports **Minecraft 1.21.4 to 1.21.11 and 26.1**, with one build per version (the 26.1 build also runs on 26.1.1 and 26.1.2). If something doesn't work on your version, please open an issue.
|
Saturn runs on Fabric and supports **Minecraft 1.21.4 to 1.21.11, 26.1 and 26.2**, with one build per version (the 26.1 build also runs on 26.1.1 and 26.1.2). If something doesn't work on your version, please open an issue.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -4,7 +4,7 @@ How Saturn Client supports several Minecraft versions, and how to change or add
|
|||||||
|
|
||||||
## Layout
|
## Layout
|
||||||
|
|
||||||
Every supported Minecraft version (1.21.4 to 1.21.11, and 26.1) builds from one copy of the version-specific code with [Stonecutter](https://stonecutter.kikugie.dev/):
|
Every supported Minecraft version (1.21.4 to 1.21.11, 26.1 and 26.2) builds from one copy of the version-specific code with [Stonecutter](https://stonecutter.kikugie.dev/):
|
||||||
|
|
||||||
- `common/`: all version-independent code (mods, UI, cosmetics, the server client). It has no Minecraft dependency and reaches the game only through the interfaces in `org.saturnclient.common`.
|
- `common/`: all version-independent code (mods, UI, cosmetics, the server client). It has no Minecraft dependency and reaches the game only through the interfaces in `org.saturnclient.common`.
|
||||||
- `src/`: the version-specific code (providers, refs, mixins and the three mixin configs), one copy for every version. Where Minecraft's API differs between versions, the code goes behind version comments (see below).
|
- `src/`: the version-specific code (providers, refs, mixins and the three mixin configs), one copy for every version. Where Minecraft's API differs between versions, the code goes behind version comments (see below).
|
||||||
@@ -18,7 +18,7 @@ Minecraft is obfuscated up to 1.21.11 and ships with Mojang's names from 26.1. T
|
|||||||
|
|
||||||
Every version is built with Mojang's official names (`loom.officialMojangMappings()`), the names Minecraft itself ships from 26.1 on. Yarn isn't used any more: 1.21.11 has the last Yarn release.
|
Every version is built with Mojang's official names (`loom.officialMojangMappings()`), the names Minecraft itself ships from 26.1 on. Yarn isn't used any more: 1.21.11 has the last Yarn release.
|
||||||
|
|
||||||
Mojang renames things between versions. `src/` uses the active version's (1.21.11's) names, and `stonecutter.gradle.kts` lists replacements that swap in each version's name when Stonecutter processes it: for example `Identifier`, which was `ResourceLocation` before 1.21.11, `AvatarRenderState`, which was `PlayerRenderState` before 1.21.9, and `GuiGraphics`, which is `GuiGraphicsExtractor` from 26.1. Add a replacement there when a rename touches many lines. A class that only moved package needs just a version comment on its import, and a renamed method a version comment where it's called.
|
Mojang renames things between versions. `src/` uses the active version's (1.21.11's) names, and `stonecutter.gradle.kts` lists replacements that swap in each version's name when Stonecutter processes it: for example `Identifier`, which was `ResourceLocation` before 1.21.11, `AvatarRenderState`, which was `PlayerRenderState` before 1.21.9, and `GuiGraphics`, which is `GuiGraphicsExtractor` from 26.1. Add a replacement there when a rename touches many lines. From 26.2 the open screen and overlay live on `Gui` rather than `Minecraft`, so code goes through `impl.ui.Screens` for them. A class that only moved package needs just a version comment on its import, and a renamed method a version comment where it's called.
|
||||||
|
|
||||||
Released 1.21.x jars run on intermediary names (`method_1234`), not Mojang's, and Loom renames everything that refers to Minecraft when it builds them. So a mixin can't implement one of `common`'s Ref interfaces by relying on a vanilla method that happens to have the same name: the vanilla method is renamed in the jar, and the interface method is left without an implementation (`AbstractMethodError`). Shadow the vanilla method and implement the Ref method explicitly, as `WindowMixin` does. For the same reason, Ref methods mustn't share a name and parameters with a method of the class they're mixed into, or the mixin replaces the vanilla method in development.
|
Released 1.21.x jars run on intermediary names (`method_1234`), not Mojang's, and Loom renames everything that refers to Minecraft when it builds them. So a mixin can't implement one of `common`'s Ref interfaces by relying on a vanilla method that happens to have the same name: the vanilla method is renamed in the jar, and the interface method is left without an implementation (`AbstractMethodError`). Shadow the vanilla method and implement the Ref method explicitly, as `WindowMixin` does. For the same reason, Ref methods mustn't share a name and parameters with a method of the class they're mixed into, or the mixin replaces the vanilla method in development.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ include("common")
|
|||||||
// versions/<v>/gradle.properties holds its Minecraft, Fabric Loader and Fabric API versions.
|
// versions/<v>/gradle.properties holds its Minecraft, Fabric Loader and Fabric API versions.
|
||||||
val stonecutterVersions = listOf(
|
val stonecutterVersions = listOf(
|
||||||
"1.21.4", "1.21.5", "1.21.6", "1.21.7", "1.21.8", "1.21.9", "1.21.10", "1.21.11",
|
"1.21.4", "1.21.5", "1.21.6", "1.21.7", "1.21.8", "1.21.9", "1.21.10", "1.21.11",
|
||||||
"26.1",
|
"26.1", "26.2",
|
||||||
)
|
)
|
||||||
|
|
||||||
stonecutter {
|
stonecutter {
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import net.minecraft.client.renderer.GameRenderer;
|
|||||||
|
|
||||||
//? if >=1.21.6
|
//? if >=1.21.6
|
||||||
import org.saturnclient.impl.ui.SaturnScreenFabric;
|
import org.saturnclient.impl.ui.SaturnScreenFabric;
|
||||||
|
//? if >=1.21.6
|
||||||
|
import org.saturnclient.impl.ui.Screens;
|
||||||
import org.saturnclient.impl.features.render.ZoomFov;
|
import org.saturnclient.impl.features.render.ZoomFov;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@@ -53,7 +55,7 @@ public class GameRendererMixin {
|
|||||||
@Redirect(method = "render", at = @At(value = "INVOKE",
|
@Redirect(method = "render", at = @At(value = "INVOKE",
|
||||||
target = "Lnet/minecraft/client/Options;getMenuBackgroundBlurriness()I"))
|
target = "Lnet/minecraft/client/Options;getMenuBackgroundBlurriness()I"))
|
||||||
private int useSaturnBlur(Options options) {
|
private int useSaturnBlur(Options options) {
|
||||||
if (Minecraft.getInstance().screen instanceof SaturnScreenFabric saturnScreen) {
|
if (Screens.current() instanceof SaturnScreenFabric saturnScreen) {
|
||||||
return saturnScreen.screen.getBackgroundBlur();
|
return saturnScreen.screen.getBackgroundBlur();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,15 @@ package org.saturnclient.impl.features.mixins.render;
|
|||||||
|
|
||||||
import net.minecraft.client.gui.Font;
|
import net.minecraft.client.gui.Font;
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
|
//? if >=26.2 {
|
||||||
|
/*import net.minecraft.client.gui.Hud;
|
||||||
|
*///?} else
|
||||||
import net.minecraft.client.gui.Gui;
|
import net.minecraft.client.gui.Gui;
|
||||||
import net.minecraft.client.DeltaTracker;
|
import net.minecraft.client.DeltaTracker;
|
||||||
|
|
||||||
import org.saturnclient.impl.ui.RenderScopeImpl;
|
import org.saturnclient.impl.ui.RenderScopeImpl;
|
||||||
import org.saturnclient.impl.ui.SaturnScreenFabric;
|
import org.saturnclient.impl.ui.SaturnScreenFabric;
|
||||||
|
import org.saturnclient.impl.ui.Screens;
|
||||||
import org.saturnclient.mod.HudMod;
|
import org.saturnclient.mod.HudMod;
|
||||||
import org.saturnclient.mod.Mod;
|
import org.saturnclient.mod.Mod;
|
||||||
import org.saturnclient.mod.ModLayout;
|
import org.saturnclient.mod.ModLayout;
|
||||||
@@ -37,6 +41,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
* {@link SaturnScreenFabric} / {@link HudEditor} pair; that is
|
* {@link SaturnScreenFabric} / {@link HudEditor} pair; that is
|
||||||
* unchanged infrastructure.
|
* unchanged infrastructure.
|
||||||
*/
|
*/
|
||||||
|
// The HUD is drawn by Hud from 26.2 (by Gui before).
|
||||||
|
//? if >=26.2 {
|
||||||
|
/*@Mixin(Hud.class)
|
||||||
|
*///?} else
|
||||||
@Mixin(Gui.class)
|
@Mixin(Gui.class)
|
||||||
public class RenderMixin {
|
public class RenderMixin {
|
||||||
|
|
||||||
@@ -51,7 +59,7 @@ public class RenderMixin {
|
|||||||
// can draw its own preview layout without double-drawing.
|
// can draw its own preview layout without double-drawing.
|
||||||
if (textRenderer == null)
|
if (textRenderer == null)
|
||||||
return;
|
return;
|
||||||
if (SaturnClient.client.screen instanceof SaturnScreenFabric f
|
if (Screens.current() instanceof SaturnScreenFabric f
|
||||||
&& f.screen instanceof HudEditor)
|
&& f.screen instanceof HudEditor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ import java.io.File;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import org.saturnclient.common.ref.asset.IdentifierRef;
|
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||||
import org.saturnclient.common.ref.game.MinecraftClientRef;
|
import org.saturnclient.common.ref.game.MinecraftClientRef;
|
||||||
import org.saturnclient.common.ref.render.WindowRef;
|
import org.saturnclient.common.ref.render.WindowRef;
|
||||||
import org.saturnclient.impl.ui.SaturnScreenFabric;
|
import org.saturnclient.impl.ui.SaturnScreenFabric;
|
||||||
|
import org.saturnclient.impl.ui.Screens;
|
||||||
import org.saturnclient.ui.SaturnScreen;
|
import org.saturnclient.ui.SaturnScreen;
|
||||||
import org.saturnclient.ui.screens.TitleMenu;
|
import org.saturnclient.ui.screens.TitleMenu;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@@ -16,7 +16,6 @@ import org.spongepowered.asm.mixin.Shadow;
|
|||||||
|
|
||||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
|
||||||
import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen;
|
import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen;
|
||||||
import net.minecraft.client.gui.screens.options.OptionsScreen;
|
import net.minecraft.client.gui.screens.options.OptionsScreen;
|
||||||
import net.minecraft.client.gui.screens.worldselection.SelectWorldScreen;
|
import net.minecraft.client.gui.screens.worldselection.SelectWorldScreen;
|
||||||
@@ -43,9 +42,6 @@ public abstract class MinecraftClientMixin implements MinecraftClientRef {
|
|||||||
@Shadow
|
@Shadow
|
||||||
private User user;
|
private User user;
|
||||||
|
|
||||||
@Shadow
|
|
||||||
public abstract void setScreen(@Nullable Screen screen);
|
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
public abstract void stop();
|
public abstract void stop();
|
||||||
|
|
||||||
@@ -75,7 +71,7 @@ public abstract class MinecraftClientMixin implements MinecraftClientRef {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setScreen(SaturnScreen screen) {
|
public void setScreen(SaturnScreen screen) {
|
||||||
this.setScreen(new SaturnScreenFabric(screen));
|
Screens.set(new SaturnScreenFabric(screen));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -84,18 +80,18 @@ public abstract class MinecraftClientMixin implements MinecraftClientRef {
|
|||||||
|
|
||||||
switch (screen) {
|
switch (screen) {
|
||||||
case SelectWorld:
|
case SelectWorld:
|
||||||
this.setScreen(new SelectWorldScreen(exitTarget));
|
Screens.set(new SelectWorldScreen(exitTarget));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Multiplayer:
|
case Multiplayer:
|
||||||
this.setScreen(new JoinMultiplayerScreen(exitTarget));
|
Screens.set(new JoinMultiplayerScreen(exitTarget));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Options:
|
case Options:
|
||||||
//? if >=26.1 {
|
//? if >=26.1 {
|
||||||
/*this.setScreen(new OptionsScreen(exitTarget, this.options, ((Minecraft) (Object) this).level != null));
|
/*Screens.set(new OptionsScreen(exitTarget, this.options, ((Minecraft) (Object) this).level != null));
|
||||||
*///?} else
|
*///?} else
|
||||||
this.setScreen(new OptionsScreen(exitTarget, this.options));
|
Screens.set(new OptionsScreen(exitTarget, this.options));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ import org.saturnclient.common.ref.game.EffectRef;
|
|||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
|
//? if >=26.2 {
|
||||||
|
/*import net.minecraft.client.gui.Hud;
|
||||||
|
*///?} else
|
||||||
import net.minecraft.client.gui.Gui;
|
import net.minecraft.client.gui.Gui;
|
||||||
import net.minecraft.world.effect.MobEffect;
|
import net.minecraft.world.effect.MobEffect;
|
||||||
import net.minecraft.world.effect.MobEffectInstance;
|
import net.minecraft.world.effect.MobEffectInstance;
|
||||||
@@ -55,6 +58,9 @@ public abstract class StatusEffectMixin implements EffectRef {
|
|||||||
//? if >=1.21.6 {
|
//? if >=1.21.6 {
|
||||||
@Override
|
@Override
|
||||||
public IdentifierRef getIconId() {
|
public IdentifierRef getIconId() {
|
||||||
|
//? if >=26.2 {
|
||||||
|
/*Identifier id = Hud.getMobEffectSprite(getEffect());
|
||||||
|
*///?} else
|
||||||
Identifier id = Gui.getMobEffectSprite(getEffect());
|
Identifier id = Gui.getMobEffectSprite(getEffect());
|
||||||
|
|
||||||
return IdentifierRef.of(id.getNamespace(), "textures/" + id.getPath() + ".png");
|
return IdentifierRef.of(id.getNamespace(), "textures/" + id.getPath() + ".png");
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package org.saturnclient.impl.provider;
|
|||||||
|
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
import org.saturnclient.common.provider.GLFWProvider;
|
import org.saturnclient.common.provider.GLFWProvider;
|
||||||
|
import org.saturnclient.impl.ui.Screens;
|
||||||
import org.saturnclient.saturnclient.SaturnClient;
|
import org.saturnclient.saturnclient.SaturnClient;
|
||||||
|
|
||||||
public class GLFWProviderImpl implements GLFWProvider {
|
public class GLFWProviderImpl implements GLFWProvider {
|
||||||
@@ -12,7 +13,7 @@ public class GLFWProviderImpl implements GLFWProvider {
|
|||||||
//?} else
|
//?} else
|
||||||
//long window = SaturnClient.client.getWindow().getWindow();
|
//long window = SaturnClient.client.getWindow().getWindow();
|
||||||
return GLFW.glfwGetKey(window, key) == GLFW.GLFW_PRESS
|
return GLFW.glfwGetKey(window, key) == GLFW.GLFW_PRESS
|
||||||
&& SaturnClient.client.screen == null;
|
&& Screens.current() == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -86,8 +86,13 @@ public class SaturnProviderImpl implements SaturnProvider {
|
|||||||
@Override
|
@Override
|
||||||
public void showWarning(String title, String message) {
|
public void showWarning(String title, String message) {
|
||||||
Minecraft client = Minecraft.getInstance();
|
Minecraft client = Minecraft.getInstance();
|
||||||
|
//? if >=26.2 {
|
||||||
|
/*client.execute(() -> SystemToast.add(client.gui.toastManager(), WARNING_TOAST, Component.literal(title),
|
||||||
|
Component.literal(message)));
|
||||||
|
*///?} else {
|
||||||
client.execute(() -> client.getToastManager().addToast(
|
client.execute(() -> client.getToastManager().addToast(
|
||||||
SystemToast.multiline(client, WARNING_TOAST, Component.literal(title), Component.literal(message))));
|
SystemToast.multiline(client, WARNING_TOAST, Component.literal(title), Component.literal(message))));
|
||||||
|
//?}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ import net.minecraft.client.renderer.PostChain;
|
|||||||
import net.minecraft.client.renderer.RenderPipelines;
|
import net.minecraft.client.renderer.RenderPipelines;
|
||||||
import com.mojang.blaze3d.pipeline.TextureTarget;
|
import com.mojang.blaze3d.pipeline.TextureTarget;
|
||||||
import net.minecraft.client.renderer.LevelTargetBundle;
|
import net.minecraft.client.renderer.LevelTargetBundle;
|
||||||
|
//? if >=26.2 {
|
||||||
|
/*import com.mojang.blaze3d.GpuFormat;
|
||||||
|
import net.minecraft.client.renderer.BindGroupLayouts;
|
||||||
|
*///?}
|
||||||
//? if >=26.1 {
|
//? if >=26.1 {
|
||||||
/*import net.minecraft.client.renderer.Projection;
|
/*import net.minecraft.client.renderer.Projection;
|
||||||
import net.minecraft.client.renderer.ProjectionMatrixBuffer;
|
import net.minecraft.client.renderer.ProjectionMatrixBuffer;
|
||||||
@@ -51,6 +55,9 @@ public final class GlassRenderer {
|
|||||||
public static final RenderPipeline PIPELINE = RenderPipeline.builder(RenderPipelines.GUI_TEXTURED_SNIPPET)
|
public static final RenderPipeline PIPELINE = RenderPipeline.builder(RenderPipelines.GUI_TEXTURED_SNIPPET)
|
||||||
.withLocation(Identifier.fromNamespaceAndPath("saturnclient", "pipeline/glass"))
|
.withLocation(Identifier.fromNamespaceAndPath("saturnclient", "pipeline/glass"))
|
||||||
.withFragmentShader(Identifier.fromNamespaceAndPath("saturnclient", "core/glass"))
|
.withFragmentShader(Identifier.fromNamespaceAndPath("saturnclient", "core/glass"))
|
||||||
|
//? if >=26.2 {
|
||||||
|
/*.withBindGroupLayout(BindGroupLayouts.SAMPLER1)
|
||||||
|
*///?} else
|
||||||
.withSampler("Sampler1")
|
.withSampler("Sampler1")
|
||||||
// The transforms block ends with LineWidth before 1.21.11 (see glass.fsh).
|
// The transforms block ends with LineWidth before 1.21.11 (see glass.fsh).
|
||||||
//? if <1.21.11
|
//? if <1.21.11
|
||||||
@@ -81,12 +88,18 @@ public final class GlassRenderer {
|
|||||||
// Copies the main framebuffer and blurs the copy by blur. Call once a frame for each blur, while
|
// Copies the main framebuffer and blurs the copy by blur. Call once a frame for each blur, while
|
||||||
// the screen builds its GUI, before drawing glass with it.
|
// the screen builds its GUI, before drawing glass with it.
|
||||||
public static void captureBackdrop(int blur) {
|
public static void captureBackdrop(int blur) {
|
||||||
|
//? if >=26.2 {
|
||||||
|
/*RenderTarget main = SaturnClient.client.gameRenderer.mainRenderTarget();
|
||||||
|
*///?} else
|
||||||
RenderTarget main = SaturnClient.client.getMainRenderTarget();
|
RenderTarget main = SaturnClient.client.getMainRenderTarget();
|
||||||
int width = main.width;
|
int width = main.width;
|
||||||
int height = main.height;
|
int height = main.height;
|
||||||
|
|
||||||
TextureTarget backdrop = BACKDROPS.get(blur);
|
TextureTarget backdrop = BACKDROPS.get(blur);
|
||||||
if (backdrop == null) {
|
if (backdrop == null) {
|
||||||
|
//? if >=26.2 {
|
||||||
|
/*backdrop = new TextureTarget("Saturn glass " + blur, width, height, false, GpuFormat.RGBA8_UNORM);
|
||||||
|
*///?} else
|
||||||
backdrop = new TextureTarget("Saturn glass " + blur, width, height, false);
|
backdrop = new TextureTarget("Saturn glass " + blur, width, height, false);
|
||||||
BACKDROPS.put(blur, backdrop);
|
BACKDROPS.put(blur, backdrop);
|
||||||
} else if (backdrop.width != width || backdrop.height != height) {
|
} else if (backdrop.width != width || backdrop.height != height) {
|
||||||
|
|||||||
@@ -146,7 +146,9 @@ public class SaturnScreenFabric extends Screen implements ScreenProvider {
|
|||||||
// The panorama renderer has no opacity (and takes no delta) from 1.21.6, so it's drawn fully
|
// The panorama renderer has no opacity (and takes no delta) from 1.21.6, so it's drawn fully
|
||||||
// opaque.
|
// opaque.
|
||||||
if (isShowingPanorama()) {
|
if (isShowingPanorama()) {
|
||||||
//? if >=26.1 {
|
//? if >=26.2 {
|
||||||
|
/*ROTATING_PANORAMA_RENDERER.extractRenderState(context, this.width, this.height);
|
||||||
|
*///?} else if >=26.1 {
|
||||||
/*ROTATING_PANORAMA_RENDERER.extractRenderState(context, this.width, this.height, true);
|
/*ROTATING_PANORAMA_RENDERER.extractRenderState(context, this.width, this.height, true);
|
||||||
*///?} else
|
*///?} else
|
||||||
ROTATING_PANORAMA_RENDERER.render(context, this.width, this.height, true);
|
ROTATING_PANORAMA_RENDERER.render(context, this.width, this.height, true);
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package org.saturnclient.impl.ui;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
|
|
||||||
|
/** The open screen and overlay, which Minecraft holds before 26.2 and its Gui from 26.2. */
|
||||||
|
public final class Screens {
|
||||||
|
private Screens() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static @Nullable Screen current() {
|
||||||
|
//? if >=26.2 {
|
||||||
|
/*return Minecraft.getInstance().gui.screen();
|
||||||
|
*///?} else
|
||||||
|
return Minecraft.getInstance().screen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void set(@Nullable Screen screen) {
|
||||||
|
//? if >=26.2 {
|
||||||
|
/*Minecraft.getInstance().gui.setScreen(screen);
|
||||||
|
*///?} else
|
||||||
|
Minecraft.getInstance().setScreen(screen);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clearOverlay() {
|
||||||
|
//? if >=26.2 {
|
||||||
|
/*Minecraft.getInstance().gui.setOverlay(null);
|
||||||
|
*///?} else
|
||||||
|
Minecraft.getInstance().setOverlay(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,6 +16,7 @@ import org.saturnclient.common.provider.Providers;
|
|||||||
import org.saturnclient.client.ServiceClient;
|
import org.saturnclient.client.ServiceClient;
|
||||||
import org.saturnclient.emotes.fabric.Emotes;
|
import org.saturnclient.emotes.fabric.Emotes;
|
||||||
import org.saturnclient.impl.ui.SaturnScreenFabric;
|
import org.saturnclient.impl.ui.SaturnScreenFabric;
|
||||||
|
import org.saturnclient.impl.ui.Screens;
|
||||||
import org.saturnclient.ui.screens.EmoteWheel;
|
import org.saturnclient.ui.screens.EmoteWheel;
|
||||||
import org.saturnclient.ui.screens.ShiftMenu;
|
import org.saturnclient.ui.screens.ShiftMenu;
|
||||||
|
|
||||||
@@ -69,9 +70,9 @@ public class KeyInputHandler {
|
|||||||
&& !InputConstants.isKeyDown(client.getWindow(), GLFW.GLFW_KEY_F3)) {
|
&& !InputConstants.isKeyDown(client.getWindow(), GLFW.GLFW_KEY_F3)) {
|
||||||
//?} else
|
//?} else
|
||||||
//&& !InputConstants.isKeyDown(client.getWindow().getWindow(), GLFW.GLFW_KEY_F3)) {
|
//&& !InputConstants.isKeyDown(client.getWindow().getWindow(), GLFW.GLFW_KEY_F3)) {
|
||||||
if (client.screen == null) {
|
if (Screens.current() == null) {
|
||||||
Providers.saturn.getClient().setScreen(new EmoteWheel());
|
Providers.saturn.getClient().setScreen(new EmoteWheel());
|
||||||
} else if (client.screen instanceof SaturnScreenFabric saturnScreen
|
} else if (Screens.current() instanceof SaturnScreenFabric saturnScreen
|
||||||
&& saturnScreen.screen instanceof EmoteWheel) {
|
&& saturnScreen.screen instanceof EmoteWheel) {
|
||||||
saturnScreen.onClose();
|
saturnScreen.onClose();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ package org.saturnclient.saturnclient.mixin;
|
|||||||
//? if >=26.1 {
|
//? if >=26.1 {
|
||||||
/*import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
/*import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.render.GuiRenderer;
|
import net.minecraft.client.gui.render.GuiRenderer;
|
||||||
import net.minecraft.client.renderer.CubeMap;
|
import net.minecraft.client.renderer.CubeMap;
|
||||||
import org.saturnclient.impl.ui.SaturnScreenFabric;
|
import org.saturnclient.impl.ui.SaturnScreenFabric;
|
||||||
|
import org.saturnclient.impl.ui.Screens;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
*///?} else
|
*///?} else
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
@@ -24,7 +24,7 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||||||
public class GuiRendererMixin {
|
public class GuiRendererMixin {
|
||||||
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/CubeMap;render(FF)V"))
|
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/CubeMap;render(FF)V"))
|
||||||
private void saturn$drawSaturnPanorama(CubeMap cubeMap, float xRot, float yRot, Operation<Void> original) {
|
private void saturn$drawSaturnPanorama(CubeMap cubeMap, float xRot, float yRot, Operation<Void> original) {
|
||||||
boolean saturnScreen = Minecraft.getInstance().screen instanceof SaturnScreenFabric;
|
boolean saturnScreen = Screens.current() instanceof SaturnScreenFabric;
|
||||||
original.call(saturnScreen ? SaturnScreenFabric.PANORAMA_RENDERER : cubeMap, xRot, yRot);
|
original.call(saturnScreen ? SaturnScreenFabric.PANORAMA_RENDERER : cubeMap, xRot, yRot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,9 +8,15 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
//? if >=26.2
|
||||||
|
//import net.minecraft.client.gui.Gui;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.client.gui.screens.TitleScreen;
|
import net.minecraft.client.gui.screens.TitleScreen;
|
||||||
|
|
||||||
|
// Screens are opened through Gui from 26.2 (through Minecraft before).
|
||||||
|
//? if >=26.2 {
|
||||||
|
/*@Mixin(Gui.class)
|
||||||
|
*///?} else
|
||||||
@Mixin(Minecraft.class)
|
@Mixin(Minecraft.class)
|
||||||
public class SetScreenMixin {
|
public class SetScreenMixin {
|
||||||
@ModifyVariable(method = "setScreen", at = @At("HEAD"), argsOnly = true)
|
@ModifyVariable(method = "setScreen", at = @At("HEAD"), argsOnly = true)
|
||||||
@@ -18,7 +24,7 @@ public class SetScreenMixin {
|
|||||||
if (Config.saturnTitleScreen.value) {
|
if (Config.saturnTitleScreen.value) {
|
||||||
if (screen instanceof TitleScreen)
|
if (screen instanceof TitleScreen)
|
||||||
return new SaturnScreenFabric(new TitleMenu());
|
return new SaturnScreenFabric(new TitleMenu());
|
||||||
if (screen == null && ((Minecraft) (Object) this).level == null)
|
if (screen == null && Minecraft.getInstance().level == null)
|
||||||
return new SaturnScreenFabric(new TitleMenu());
|
return new SaturnScreenFabric(new TitleMenu());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package org.saturnclient.saturnclient.mixin;
|
package org.saturnclient.saturnclient.mixin;
|
||||||
|
|
||||||
|
import org.saturnclient.impl.ui.Screens;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
@@ -110,7 +112,7 @@ public abstract class SplashOverlayMixin {
|
|||||||
|
|
||||||
// Remove overlay after fade-out completes
|
// Remove overlay after fade-out completes
|
||||||
if (fadeOutProgress >= 2.0F) {
|
if (fadeOutProgress >= 2.0F) {
|
||||||
minecraft.setOverlay(null);
|
Screens.clearOverlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle reload completion and exceptions
|
// Handle reload completion and exceptions
|
||||||
@@ -118,11 +120,11 @@ public abstract class SplashOverlayMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void renderCurrentScreen(GuiGraphics context, int mouseX, int mouseY, float delta) {
|
private void renderCurrentScreen(GuiGraphics context, int mouseX, int mouseY, float delta) {
|
||||||
if (minecraft.screen != null) {
|
if (Screens.current() != null) {
|
||||||
//? if >=26.1 {
|
//? if >=26.1 {
|
||||||
/*minecraft.screen.extractRenderState(context, mouseX, mouseY, delta);
|
/*Screens.current().extractRenderState(context, mouseX, mouseY, delta);
|
||||||
*///?} else
|
*///?} else
|
||||||
minecraft.screen.render(context, mouseX, mouseY, delta);
|
Screens.current().render(context, mouseX, mouseY, delta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,11 @@ public abstract class SplashOverlayMixin {
|
|||||||
|
|
||||||
//? if >=1.21.11
|
//? if >=1.21.11
|
||||||
Window window = minecraft.getWindow();
|
Window window = minecraft.getWindow();
|
||||||
if (minecraft.screen != null) {
|
if (Screens.current() != null) {
|
||||||
//? if >=1.21.11 {
|
//? if >=1.21.11 {
|
||||||
minecraft.screen.init(window.getGuiScaledWidth(), window.getGuiScaledHeight());
|
Screens.current().init(window.getGuiScaledWidth(), window.getGuiScaledHeight());
|
||||||
//?} else
|
//?} else
|
||||||
//minecraft.screen.init(minecraft, context.guiWidth(), context.guiHeight());
|
//Screens.current().init(minecraft, context.guiWidth(), context.guiHeight());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# Done to increase the memory available to gradle.
|
||||||
|
org.gradle.jvmargs=-Xmx1G
|
||||||
|
org.gradle.parallel=true
|
||||||
|
|
||||||
|
# IntelliJ IDEA is not yet fully compatible with configuration cache, see: https://github.com/FabricMC/fabric-loom/issues/1349
|
||||||
|
org.gradle.configuration-cache=false
|
||||||
|
|
||||||
|
# Fabric Properties
|
||||||
|
# check these on https://fabricmc.net/develop
|
||||||
|
minecraft_version=26.2
|
||||||
|
loader_version=0.19.5
|
||||||
|
|
||||||
|
fabric_api_version=0.161.0+26.2
|
||||||
|
|
||||||
|
# Mod Properties
|
||||||
|
maven_group=org.saturnclient
|
||||||
|
archives_base_name=saturn-client
|
||||||
Reference in New Issue
Block a user