port: Chase the Skies (1.21.6)

This commit is contained in:
Martin Prokoph
2025-06-17 19:44:15 +02:00
parent ee274fcefd
commit 97117ea46a
4 changed files with 20 additions and 28 deletions

View File

@@ -57,6 +57,7 @@ public class PuzzleOptionListWidget extends MidnightConfig.MidnightConfigListWid
public boolean centered() {return true;}
public String category() {return "";}
public String name() {return "";}
public String url() {return "";}
public String requiredMod() {return "";}
};
var entry = new MidnightConfig.ButtonEntry(buttons, text, info);

View File

@@ -7,13 +7,9 @@ import com.mojang.blaze3d.platform.DestFactor;
import com.mojang.blaze3d.platform.SourceFactor;
import eu.midnightdust.lib.util.MidnightColorUtil;
import eu.midnightdust.lib.util.PlatformFunctions;
import net.minecraft.client.gui.screen.SplashOverlay;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.RenderPhase;
import net.minecraft.client.texture.NativeImageBackedTexture;
import net.minecraft.client.texture.TextureContents;
import net.minecraft.resource.*;
import net.minecraft.util.TriState;
import net.minecraft.util.Util;
import net.puzzlemc.core.config.PuzzleConfig;
import net.minecraft.client.MinecraftClient;
@@ -45,7 +41,7 @@ public class PuzzleSplashScreen {
public static Path BACKGROUND_TEXTURE = Paths.get(CONFIG_PATH + "/splash_background.png");
private static MinecraftClient client = MinecraftClient.getInstance();
private static boolean keepBackground = false;
private static RenderLayer CUSTOM_LOGO_LAYER;
private static RenderPipeline CUSTOM_LOGO_PIPELINE;
public static void init() {
if (!CONFIG_PATH.exists()) { // Run when config directory is nonexistent //
@@ -59,8 +55,8 @@ public class PuzzleSplashScreen {
buildRenderLayer();
}
public static RenderLayer getCustomLogoRenderLayer() {
return CUSTOM_LOGO_LAYER;
public static RenderPipeline getCustomLogoRenderPipeline() {
return CUSTOM_LOGO_PIPELINE;
}
public static void buildRenderLayer() {
@@ -85,10 +81,7 @@ public class PuzzleSplashScreen {
.withDepthWrite(false);
CUSTOM_LOGO_PIPELINE_BUILDER = blendFunction != null ? CUSTOM_LOGO_PIPELINE_BUILDER.withBlend(blendFunction) : CUSTOM_LOGO_PIPELINE_BUILDER.withoutBlend();
CUSTOM_LOGO_LAYER = RenderLayer.of("mojang_logo_puzzle", 786432, CUSTOM_LOGO_PIPELINE_BUILDER.build(),
RenderLayer.MultiPhaseParameters.builder()
.texture(new RenderPhase.Texture(SplashOverlay.LOGO, TriState.DEFAULT, false))
.build(false));
CUSTOM_LOGO_PIPELINE = CUSTOM_LOGO_PIPELINE_BUILDER.build();
}
}

View File

@@ -2,11 +2,12 @@ package net.puzzlemc.splashscreen.mixin;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.mojang.blaze3d.pipeline.RenderPipeline;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gl.RenderPipelines;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Overlay;
import net.minecraft.client.gui.screen.SplashOverlay;
import net.minecraft.client.render.*;
import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.texture.NativeImageBackedTexture;
import net.minecraft.client.texture.TextureManager;
@@ -26,7 +27,6 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.util.function.Function;
import java.util.function.IntSupplier;
import static net.puzzlemc.splashscreen.PuzzleSplashScreen.BACKGROUND;
@@ -63,11 +63,11 @@ public abstract class MixinSplashScreen extends Overlay {
return (!PuzzleConfig.resourcepackSplashScreen || PuzzleConfig.progressBarBackgroundColor == 15675965) ? instance.getAsInt() : PuzzleConfig.backgroundColor | 255 << 24;
}
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Ljava/util/function/Function;Lnet/minecraft/util/Identifier;IIFFIIIIIII)V"))
private void puzzle$modifyRenderLayer(DrawContext instance, Function<Identifier, RenderLayer> renderLayers, Identifier sprite, int x, int y, float u, float v, int width, int height, int regionWidth, int regionHeight, int textureWidth, int textureHeight, int color, Operation<Void> original) {
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lcom/mojang/blaze3d/pipeline/RenderPipeline;Lnet/minecraft/util/Identifier;IIFFIIIIIII)V"))
private void puzzle$modifyRenderLayer(DrawContext instance, RenderPipeline pipeline, Identifier sprite, int x, int y, float u, float v, int width, int height, int regionWidth, int regionHeight, int textureWidth, int textureHeight, int color, Operation<Void> original) {
if (PuzzleConfig.resourcepackSplashScreen)
instance.drawTexture(id -> PuzzleSplashScreen.getCustomLogoRenderLayer(), sprite, x, y, u, v, width, height, regionWidth, regionHeight, textureWidth, textureHeight, color);
else instance.drawTexture(renderLayers, sprite, x, y, u, v, width, height, textureWidth, textureHeight, color);
instance.drawTexture(PuzzleSplashScreen.getCustomLogoRenderPipeline(), sprite, x, y, u, v, width, height, regionWidth, regionHeight, textureWidth, textureHeight, color);
else instance.drawTexture(pipeline, sprite, x, y, u, v, width, height, textureWidth, textureHeight, color);
}
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;getScaledWindowWidth()I", ordinal = 2))
@@ -82,14 +82,12 @@ public abstract class MixinSplashScreen extends Overlay {
if (f >= 1.0F) s = 1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F);
else if (reloading) s = MathHelper.clamp(g, 0.0F, 1.0F);
else s = 1.0F;
context.getMatrices().translate(0, 0, 1f);
context.drawTexture(RenderLayer::getGuiTextured, BACKGROUND, 0, 0, 0, 0, width, height, width, height, ColorHelper.getWhite(s));
context.drawTexture(RenderPipelines.GUI_TEXTURED, BACKGROUND, 0, 0, 0, 0, width, height, width, height, ColorHelper.getWhite(s));
}
}
@Inject(method = "renderProgressBar", at = @At("HEAD"))
private void puzzle$addProgressBarBackground(DrawContext context, int minX, int minY, int maxX, int maxY, float opacity, CallbackInfo ci) {
context.getMatrices().translate(0, 0, 1f);
if (!PuzzleConfig.resourcepackSplashScreen || PuzzleConfig.progressBarBackgroundColor == 15675965) return;
long l = Util.getMeasuringTimeMs();
float f = this.reloadCompleteTime > -1L ? (float)(l - this.reloadCompleteTime) / 1000.0F : -1.0F;

View File

@@ -1,13 +1,13 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx2G
minecraft_version=1.21.5
minecraft_version=1.21.6
supported_versions=
yarn_mappings=1.21.5+build.1
yarn_mappings=1.21.6+build.1
enabled_platforms=fabric,neoforge
# Mod Properties
mod_version = 2.1.0
mod_version = 2.1.1
maven_group = net.puzzlemc
archives_base_name = puzzle
release_type=release
@@ -15,15 +15,15 @@ curseforge_id=563977
modrinth_id=3IuO68q1
# Modloaders
fabric_loader_version=0.16.10
fabric_api_version=0.119.5+1.21.5
fabric_loader_version=0.16.14
fabric_api_version=0.127.0+1.21.6
neoforge_version=21.5.3-beta
neoforge_version=21.6.0-beta
yarn_mappings_patch_neoforge_version = 1.21+build.4
# Libraries
midnightlib_version = 1.7.0+1.21.4
modmenu_version = 13.0.0-beta.1
midnightlib_version = 1.7.4+1.21.6
modmenu_version = 15.0.0-beta.1
# Mod Integrations
cull_leaves_version = 3.0.2-fabric