Title panorama on 1.21.6+, and Fabric Loader 0.19.5 everywhere #34
@@ -14,6 +14,12 @@ import net.minecraft.client.gui.CubeMapRenderer;
|
|||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.RotatingCubeMapRenderer;
|
import net.minecraft.client.gui.RotatingCubeMapRenderer;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
//? if >=1.21.6 {
|
||||||
|
import net.minecraft.client.texture.CubemapTexture;
|
||||||
|
//?} else {
|
||||||
|
/*import net.minecraft.client.texture.ResourceTexture;
|
||||||
|
import net.minecraft.client.texture.TextureManager;
|
||||||
|
*///?}
|
||||||
//? if >=1.21.9
|
//? if >=1.21.9
|
||||||
import net.minecraft.client.input.KeyInput;
|
import net.minecraft.client.input.KeyInput;
|
||||||
//? if <1.21.6 {
|
//? if <1.21.6 {
|
||||||
@@ -21,8 +27,6 @@ import net.minecraft.client.input.KeyInput;
|
|||||||
import net.minecraft.client.render.DefaultFramebufferSet;
|
import net.minecraft.client.render.DefaultFramebufferSet;
|
||||||
import net.minecraft.client.util.Pool;
|
import net.minecraft.client.util.Pool;
|
||||||
*///?}
|
*///?}
|
||||||
import net.minecraft.client.texture.ResourceTexture;
|
|
||||||
import net.minecraft.client.texture.TextureManager;
|
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
@@ -41,14 +45,25 @@ public class SaturnScreenFabric extends Screen implements ScreenProvider {
|
|||||||
//private final Pool pool = new Pool(3);
|
//private final Pool pool = new Pool(3);
|
||||||
public final SaturnScreen screen;
|
public final SaturnScreen screen;
|
||||||
|
|
||||||
|
/** Whether the panorama's textures are loaded; it isn't drawn before (e.g. under the splash). */
|
||||||
|
private static volatile boolean panoramaReady = false;
|
||||||
|
|
||||||
public static void preload(MinecraftClient client) {
|
public static void preload(MinecraftClient client) {
|
||||||
TextureManager textureManager = client.getTextureManager();
|
//? if >=1.21.6 {
|
||||||
|
// From 1.21.6 CubeMapRenderer draws from one cube map texture made of panorama_0..5.png.
|
||||||
|
// CubeMapRenderer.registerTextures only stores it for the next resource reload, which has
|
||||||
|
// already happened by now, so register it through the overload that loads it right away.
|
||||||
|
client.getTextureManager().registerTexture(PANORAMA, new CubemapTexture(PANORAMA));
|
||||||
|
//?} else {
|
||||||
|
/*TextureManager textureManager = client.getTextureManager();
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
String var10001 = PANORAMA.getPath();
|
String var10001 = PANORAMA.getPath();
|
||||||
Identifier tex = PANORAMA.withPath(var10001 + "_" + i + ".png");
|
Identifier tex = PANORAMA.withPath(var10001 + "_" + i + ".png");
|
||||||
ResourceTexture resourceTexture = new ResourceTexture(tex);
|
ResourceTexture resourceTexture = new ResourceTexture(tex);
|
||||||
textureManager.registerTexture(tex, resourceTexture);
|
textureManager.registerTexture(tex, resourceTexture);
|
||||||
}
|
}
|
||||||
|
*///?}
|
||||||
|
panoramaReady = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SaturnScreenFabric(SaturnScreen screen) {
|
public SaturnScreenFabric(SaturnScreen screen) {
|
||||||
@@ -74,13 +89,18 @@ public class SaturnScreenFabric extends Screen implements ScreenProvider {
|
|||||||
mouseX *= 2;
|
mouseX *= 2;
|
||||||
mouseY *= 2;
|
mouseY *= 2;
|
||||||
|
|
||||||
// TODO: the panorama and the background blur (screen.backgroundBlur) are only drawn before
|
// From 1.21.6 the panorama renderer has no opacity (and takes no delta), so it's drawn fully
|
||||||
// 1.21.6 so far. See also issue #23.
|
// opaque there.
|
||||||
if (client.world == null && client.getCurrentServerEntry() == null) {
|
if (panoramaReady && client.world == null && client.getCurrentServerEntry() == null) {
|
||||||
//? if <1.21.6
|
//? if >=1.21.6 {
|
||||||
|
ROTATING_PANORAMA_RENDERER.render(context, this.width, this.height, true);
|
||||||
|
//?} else
|
||||||
//ROTATING_PANORAMA_RENDERER.render(context, this.width, this.height, screen.backgroundOpacity, delta);
|
//ROTATING_PANORAMA_RENDERER.render(context, this.width, this.height, screen.backgroundOpacity, delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: the background blur (screen.backgroundBlur) is only drawn before 1.21.6 so far. See
|
||||||
|
// also issue #23.
|
||||||
|
|
||||||
//? if <1.21.6 {
|
//? if <1.21.6 {
|
||||||
/*PostEffectProcessor postEffectProcessor = this.client.getShaderLoader().loadPostEffect(
|
/*PostEffectProcessor postEffectProcessor = this.client.getShaderLoader().loadPostEffect(
|
||||||
Identifier.ofVanilla("blur"),
|
Identifier.ofVanilla("blur"),
|
||||||
|
|||||||
Reference in New Issue
Block a user