fix: properly support MC 1.21.4

- Also, loading screen textures will now be loaded way earlier on NeoForge :)
This commit is contained in:
Martin Prokoph
2025-12-11 20:07:24 +01:00
parent 2611a29107
commit 11c8ba6837
12 changed files with 122 additions and 43 deletions

View File

@@ -72,8 +72,12 @@ dependencies {
} }
// MidnightLib // MidnightLib
val midnightlib = "eu.midnightdust:midnightlib:${mod.dep("midnightlib_version")}+${minecraft}-${loader}" val midnightlib = if (mod.dep("midnightlib_version").contains("+")) "eu.midnightdust:midnightlib:${mod.dep("midnightlib_version")}"
modImplementation(midnightlib) else "eu.midnightdust:midnightlib:${mod.dep("midnightlib_version")}+${minecraft}-${loader}"
modImplementation(midnightlib) {
exclude(group = "net.fabricmc.fabric-api")
exclude(group = "com.terraformersmc")
}
include(midnightlib) include(midnightlib)
if (loader == "fabric") { if (loader == "fabric") {
@@ -274,15 +278,15 @@ stonecutter {
replace("context.renderComponentTooltip(", "context.setComponentTooltipForNextFrame(") replace("context.renderComponentTooltip(", "context.setComponentTooltipForNextFrame(")
} }
replacements.string { replacements.string {
direction = eval(current.version, ">=1.21.5") direction = eval(current.version, ">=1.21.4")
replace("getTextureImage", "loadContents") replace("getTextureImage", "loadContents")
} }
replacements.string { replacements.string {
direction = eval(current.version, ">=1.21.5") direction = eval(current.version, ">=1.21.4")
replace("TextureImage", "TextureContents") replace("TextureImage", "TextureContents")
} }
replacements.string { replacements.string {
direction = eval(current.version, ">=1.21.5") direction = eval(current.version, ">=1.21.4")
replace("SimpleTexture", "ReloadableTexture") replace("SimpleTexture", "ReloadableTexture")
} }
replacements.string { replacements.string {

View File

@@ -21,9 +21,9 @@ stonecutter {
fun mc(loader: String, vararg versions: String) { fun mc(loader: String, vararg versions: String) {
for (version in versions) vers("$version-$loader", version) for (version in versions) vers("$version-$loader", version)
} }
mc("fabric","1.20.1", "1.21.1", "1.21.5", "1.21.8", "1.21.10", "1.21.11") mc("fabric","1.20.1", "1.21.1", "1.21.4", "1.21.5", "1.21.8", "1.21.10", "1.21.11")
//WARNING: neoforge uses mods.toml instead of neoforge.mods.toml for versions 1.20.4 (?) and earlier //WARNING: neoforge uses mods.toml instead of neoforge.mods.toml for versions 1.20.4 (?) and earlier
mc("neoforge", "1.21.1", "1.21.5", "1.21.8", "1.21.10", "1.21.11") mc("neoforge", "1.21.1", "1.21.4", "1.21.5", "1.21.8", "1.21.10", "1.21.11")
} }
create(rootProject) create(rootProject)
} }

View File

@@ -33,11 +33,11 @@ public class PuzzleGui {
Minecraft.getInstance().getTextureManager()./*? if >= 1.21.5 {*/ registerAndLoad /*?} else {*//*register*//*?}*/(PuzzleSplashScreen.LOGO, new PuzzleSplashScreen.LogoTexture(PuzzleSplashScreen.LOGO)); Minecraft.getInstance().getTextureManager()./*? if >= 1.21.5 {*/ registerAndLoad /*?} else {*//*register*//*?}*/(PuzzleSplashScreen.LOGO, new PuzzleSplashScreen.LogoTexture(PuzzleSplashScreen.LOGO));
})); }));
//? if < 1.21.11 { //? if < 1.21.11 {
// PuzzleApi.addToResourceOptions(new PuzzleWidget(Component.translatable("puzzle.option.unlimited_model_rotations"), (button) -> button.setMessage(PuzzleConfig.unlimitedRotations ? YES : NO), (button) -> { /*PuzzleApi.addToResourceOptions(new PuzzleWidget(Component.translatable("puzzle.option.unlimited_model_rotations"), (button) -> button.setMessage(PuzzleConfig.unlimitedRotations ? YES : NO), (button) -> {
// PuzzleConfig.unlimitedRotations = !PuzzleConfig.unlimitedRotations; PuzzleConfig.unlimitedRotations = !PuzzleConfig.unlimitedRotations;
// PuzzleConfig.write(MOD_ID); PuzzleConfig.write(MOD_ID);
// })); }));
//?} *///?}
PuzzleApi.addToResourceOptions(new PuzzleWidget(Component.translatable("puzzle.option.bigger_custom_models"), (button) -> button.setMessage(PuzzleConfig.biggerModels ? YES : NO), (button) -> { PuzzleApi.addToResourceOptions(new PuzzleWidget(Component.translatable("puzzle.option.bigger_custom_models"), (button) -> button.setMessage(PuzzleConfig.biggerModels ? YES : NO), (button) -> {
PuzzleConfig.biggerModels = !PuzzleConfig.biggerModels; PuzzleConfig.biggerModels = !PuzzleConfig.biggerModels;
PuzzleConfig.write(MOD_ID); PuzzleConfig.write(MOD_ID);

View File

@@ -23,8 +23,8 @@ public class PuzzleButtonWidget extends Button {
} catch (Exception e) {e.fillInStackTrace(); this.visible = false;} } catch (Exception e) {e.fillInStackTrace(); this.visible = false;}
//? if < 1.21.11 { //? if < 1.21.11 {
/*super.renderWidget(context, mouseX, mouseY, delta);*/ /*super.renderWidget(context, mouseX, mouseY, delta);
//?} else { *///?} else {
this.renderDefaultSprite(context); this.renderDefaultSprite(context);
this.renderDefaultLabel(context.textRendererForWidget(this, GuiGraphics.HoveredTextEffects.NONE)); this.renderDefaultLabel(context.textRendererForWidget(this, GuiGraphics.HoveredTextEffects.NONE));
//?} //?}

View File

@@ -1,6 +1,5 @@
package net.puzzlemc.splashscreen; package net.puzzlemc.splashscreen;
import com.mojang.blaze3d.pipeline.RenderPipeline;
import com.mojang.blaze3d.platform.NativeImage; import com.mojang.blaze3d.platform.NativeImage;
import eu.midnightdust.lib.util.MidnightColorUtil; import eu.midnightdust.lib.util.MidnightColorUtil;
import eu.midnightdust.lib.util.PlatformFunctions; import eu.midnightdust.lib.util.PlatformFunctions;
@@ -29,6 +28,7 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
//? if >= 1.21.5 { //? if >= 1.21.5 {
import com.mojang.blaze3d.pipeline.RenderPipeline;
import com.mojang.blaze3d.pipeline.BlendFunction; import com.mojang.blaze3d.pipeline.BlendFunction;
import com.mojang.blaze3d.platform.DepthTestFunction; import com.mojang.blaze3d.platform.DepthTestFunction;
import com.mojang.blaze3d.platform.DestFactor; import com.mojang.blaze3d.platform.DestFactor;
@@ -37,11 +37,20 @@ import net.minecraft.client.renderer.texture.TextureContents;
import net.puzzlemc.splashscreen.mixin.RenderPipelinesAccessor; import net.puzzlemc.splashscreen.mixin.RenderPipelinesAccessor;
//?} //?}
//? if = 1.21.5 { //? if = 1.21.4 || = 1.21.5 {
/*import net.minecraft.client.gui.screens.LoadingOverlay; /*import net.minecraft.client.gui.screens.LoadingOverlay;
import net.minecraft.client.renderer.RenderStateShard; import net.minecraft.client.renderer.RenderStateShard;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.util.TriState; import net.minecraft.util.TriState;
import net.minecraft.client.renderer.texture.TextureContents;
*///?}
//? if = 1.21.4 {
/*import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat;
import com.mojang.blaze3d.platform.GlStateManager;
import static net.minecraft.client.renderer.RenderStateShard.*;
*///?} *///?}
//? if >= 1.21.11 //? if >= 1.21.11
@@ -58,8 +67,9 @@ public class PuzzleSplashScreen {
public static Path BACKGROUND_TEXTURE = Paths.get(CONFIG_PATH + "/splash_background.png"); public static Path BACKGROUND_TEXTURE = Paths.get(CONFIG_PATH + "/splash_background.png");
private static Minecraft client = Minecraft.getInstance(); private static Minecraft client = Minecraft.getInstance();
private static boolean keepBackground = false; private static boolean keepBackground = false;
//? if >= 1.21.5
public static RenderPipeline CUSTOM_LOGO_PIPELINE; public static RenderPipeline CUSTOM_LOGO_PIPELINE;
//? if = 1.21.5 //? if = 1.21.5 || = 1.21.4
/*public static RenderType CUSTOM_LOGO_LAYER;*/ /*public static RenderType CUSTOM_LOGO_LAYER;*/
public static void init() { public static void init() {
@@ -71,13 +81,14 @@ public class PuzzleSplashScreen {
} }
} }
} }
//? if >= 1.21.5 //? if >= 1.21.4
buildRenderLayer(); buildRenderLayer();
} }
//? if >= 1.21.5 { //? if >= 1.21.4 {
public static void buildRenderLayer() { public static void buildRenderLayer() {
if (PuzzleConfig.resourcepackSplashScreen) { if (PuzzleConfig.resourcepackSplashScreen) {
//? if >= 1.21.5 {
BlendFunction blendFunction = new BlendFunction(SourceFactor.SRC_ALPHA, DestFactor.ONE); BlendFunction blendFunction = new BlendFunction(SourceFactor.SRC_ALPHA, DestFactor.ONE);
if (PuzzleConfig.disableBlend) blendFunction = null; if (PuzzleConfig.disableBlend) blendFunction = null;
else if (PuzzleConfig.customBlendFunction.size() == 4) { else if (PuzzleConfig.customBlendFunction.size() == 4) {
@@ -99,12 +110,38 @@ public class PuzzleSplashScreen {
CUSTOM_LOGO_PIPELINE_BUILDER = blendFunction != null ? CUSTOM_LOGO_PIPELINE_BUILDER.withBlend(blendFunction) : CUSTOM_LOGO_PIPELINE_BUILDER.withoutBlend(); CUSTOM_LOGO_PIPELINE_BUILDER = blendFunction != null ? CUSTOM_LOGO_PIPELINE_BUILDER.withBlend(blendFunction) : CUSTOM_LOGO_PIPELINE_BUILDER.withoutBlend();
CUSTOM_LOGO_PIPELINE = CUSTOM_LOGO_PIPELINE_BUILDER.build(); CUSTOM_LOGO_PIPELINE = CUSTOM_LOGO_PIPELINE_BUILDER.build();
//?}
//? if <= 1.21.5 { //? if = 1.21.5 {
/*CUSTOM_LOGO_LAYER = RenderType.create("mojang_logo_puzzle", 786432, CUSTOM_LOGO_PIPELINE, /*CUSTOM_LOGO_LAYER = RenderType.create("mojang_logo_puzzle", 786432, CUSTOM_LOGO_PIPELINE,
RenderType.CompositeState.builder() RenderType.CompositeState.builder()
.setTextureState(new RenderStateShard.TextureStateShard(LoadingOverlay.MOJANG_STUDIOS_LOGO_LOCATION, TriState.DEFAULT, false)) .setTextureState(new RenderStateShard.TextureStateShard(LoadingOverlay.MOJANG_STUDIOS_LOGO_LOCATION, TriState.DEFAULT, false))
.createCompositeState(false)); .createCompositeState(false));
*///?} else if = 1.21.4 {
/*RenderStateShard.TransparencyStateShard transparency = new RenderStateShard.TransparencyStateShard("puzzle_logo_transparency", () -> {
RenderSystem.enableBlend();
if (PuzzleConfig.disableBlend) RenderSystem.disableBlend();
else if (PuzzleConfig.customBlendFunction.size() == 4) {
try {
RenderSystem.blendFuncSeparate(
GlStateManager.SourceFactor.valueOf(PuzzleConfig.customBlendFunction.get(0)),
GlStateManager.DestFactor.valueOf(PuzzleConfig.customBlendFunction.get(1)),
GlStateManager.SourceFactor.valueOf(PuzzleConfig.customBlendFunction.get(2)),
GlStateManager.DestFactor.valueOf(PuzzleConfig.customBlendFunction.get(3)));
} catch (Exception e) {
LOGGER.error("Incorrect blend function defined in color.properties: {}{}", PuzzleConfig.customBlendFunction, e.getMessage());
}
}
}, () -> {
RenderSystem.disableBlend();
RenderSystem.defaultBlendFunc();
});
CUSTOM_LOGO_LAYER = RenderType.create("mojang_logo", DefaultVertexFormat.POSITION_TEX_COLOR, VertexFormat.Mode.QUADS, 786432, RenderType.CompositeState.builder().setTextureState(new RenderStateShard.TextureStateShard(LoadingOverlay.MOJANG_STUDIOS_LOGO_LOCATION, TriState.DEFAULT, false))
.setShaderState(POSITION_TEXTURE_COLOR_SHADER)
.setTransparencyState(transparency)
.setDepthTestState(NO_DEPTH_TEST)
.setWriteMaskState(COLOR_WRITE)
.createCompositeState(false));
*///?} *///?}
} }
} }
@@ -120,8 +157,8 @@ public class PuzzleSplashScreen {
client = Minecraft.getInstance(); client = Minecraft.getInstance();
if (PuzzleConfig.resourcepackSplashScreen) { if (PuzzleConfig.resourcepackSplashScreen) {
PuzzleSplashScreen.resetColors(); PuzzleSplashScreen.resetColors();
client.getTextureManager()./*? if >= 1.21.5 {*/ registerAndLoad /*?} else {*//*register*//*?}*/(LOGO, new LogoTexture(LOGO)); client.getTextureManager()./*? if >= 1.21.4 {*/ registerAndLoad /*?} else {*//*register*//*?}*/(LOGO, new LogoTexture(LOGO));
client.getTextureManager()./*? if >= 1.21.5 {*/ registerAndLoad /*?} else {*//*register*//*?}*/(BACKGROUND, new LogoTexture(BACKGROUND)); client.getTextureManager()./*? if >= 1.21.4 {*/ registerAndLoad /*?} else {*//*register*//*?}*/(BACKGROUND, new LogoTexture(BACKGROUND));
manager.listResources("optifine", path -> path.getPath().contains("color.properties")).forEach((id, resource) -> { manager.listResources("optifine", path -> path.getPath().contains("color.properties")).forEach((id, resource) -> {
try (InputStream stream = resource.open()) { try (InputStream stream = resource.open()) {
@@ -159,7 +196,7 @@ public class PuzzleSplashScreen {
manager.listResources("textures", path -> path.getPath().contains("mojangstudios.png")).forEach((id, resource) -> { manager.listResources("textures", path -> path.getPath().contains("mojangstudios.png")).forEach((id, resource) -> {
try (InputStream stream = resource.open()) { try (InputStream stream = resource.open()) {
Files.copy(stream, LOGO_TEXTURE, StandardCopyOption.REPLACE_EXISTING); Files.copy(stream, LOGO_TEXTURE, StandardCopyOption.REPLACE_EXISTING);
client.getTextureManager()./*? if >= 1.21.5 {*/ registerAndLoad /*?} else {*//*register*//*?}*/(LOGO, new DynamicLogoTexture()); client.getTextureManager()./*? if >= 1.21.4 {*/ registerAndLoad /*?} else {*//*register*//*?}*/(LOGO, new DynamicLogoTexture());
if (logoCount.get() > 0) PuzzleConfig.hasCustomSplashScreen = true; if (logoCount.get() > 0) PuzzleConfig.hasCustomSplashScreen = true;
logoCount.getAndIncrement(); logoCount.getAndIncrement();
} catch (Exception e) { } catch (Exception e) {
@@ -170,7 +207,7 @@ public class PuzzleSplashScreen {
try (InputStream stream = resource.open()) { try (InputStream stream = resource.open()) {
Files.copy(stream, BACKGROUND_TEXTURE, StandardCopyOption.REPLACE_EXISTING); Files.copy(stream, BACKGROUND_TEXTURE, StandardCopyOption.REPLACE_EXISTING);
InputStream input = new FileInputStream(String.valueOf(PuzzleSplashScreen.BACKGROUND_TEXTURE)); InputStream input = new FileInputStream(String.valueOf(PuzzleSplashScreen.BACKGROUND_TEXTURE));
client.getTextureManager().register(BACKGROUND, new DynamicTexture(/*? if >= 1.21.5 {*/() -> "splash_screen_background",/*?}*/ NativeImage.read(input))); client.getTextureManager().register(BACKGROUND, new DynamicTexture(/*? if >= 1.21.5 {*/ () -> "splash_screen_background", /*?}*/ NativeImage.read(input)));
keepBackground = true; keepBackground = true;
PuzzleConfig.hasCustomSplashScreen = true; PuzzleConfig.hasCustomSplashScreen = true;
} catch (Exception e) { } catch (Exception e) {
@@ -211,9 +248,9 @@ public class PuzzleSplashScreen {
Minecraft client = Minecraft.getInstance(); Minecraft client = Minecraft.getInstance();
VanillaPackResources defaultResourcePack = client.getVanillaPackResources(); VanillaPackResources defaultResourcePack = client.getVanillaPackResources();
try (InputStream input = Objects.requireNonNull(defaultResourcePack.getResource(PackType.CLIENT_RESOURCES, LOGO)).get()) { try (InputStream input = Objects.requireNonNull(defaultResourcePack.getResource(PackType.CLIENT_RESOURCES, LOGO)).get()) {
return /*? if >= 1.21.5 {*/ new TextureContents(NativeImage.read(input), new TextureMetadataSection(true, true /*? if >= 1.21.11 {*/, MipmapStrategy.AUTO, 0 /*?}*/)) /*?} else {*/ /*new TextureContents(new TextureMetadataSection(true, true), NativeImage.read(input)) *//*?}*/; return /*? if >= 1.21.4 {*/ new TextureContents(NativeImage.read(input), new TextureMetadataSection(true, true /*? if >= 1.21.11 {*/, MipmapStrategy.AUTO, 0 /*?}*/)) /*?} else {*/ /*new TextureContents(new TextureMetadataSection(true, true), NativeImage.read(input)) *//*?}*/;
} catch (IOException ex) { } catch (IOException ex) {
return /*? if >= 1.21.5 {*/ TextureContents.createMissing() /*?} else {*/ /*new TextureContents(ex) *//*?}*/; return /*? if >= 1.21.4 {*/ TextureContents.createMissing() /*?} else {*/ /*new TextureContents(ex) *//*?}*/;
} }
} }
} }
@@ -225,10 +262,10 @@ public class PuzzleSplashScreen {
@Override @Override
public @NotNull TextureContents loadContents(ResourceManager resourceManager) { public @NotNull TextureContents loadContents(ResourceManager resourceManager) {
try (InputStream input = new FileInputStream(String.valueOf(PuzzleSplashScreen.LOGO_TEXTURE))) { try (InputStream input = new FileInputStream(String.valueOf(PuzzleSplashScreen.LOGO_TEXTURE))) {
return /*? if >= 1.21.5 {*/ new TextureContents(NativeImage.read(input), new TextureMetadataSection(true, true/*? if >= 1.21.11 {*/, MipmapStrategy.AUTO, 0 /*?}*/)) /*?} else {*/ /*new TextureContents(new TextureMetadataSection(true, true), NativeImage.read(input)) *//*?}*/; return /*? if >= 1.21.4 {*/ new TextureContents(NativeImage.read(input), new TextureMetadataSection(true, true/*? if >= 1.21.11 {*/, MipmapStrategy.AUTO, 0 /*?}*/)) /*?} else {*/ /*new TextureContents(new TextureMetadataSection(true, true), NativeImage.read(input)) *//*?}*/;
} catch (IOException e) { } catch (IOException e) {
LOGGER.error("Encountered an error during logo loading: ", e); LOGGER.error("Encountered an error during logo loading: ", e);
//? if >= 1.21.5 { //? if >= 1.21.4 {
try { try {
return TextureContents.load(resourceManager, LOGO); return TextureContents.load(resourceManager, LOGO);
} catch (IOException ex) { } catch (IOException ex) {

View File

@@ -5,6 +5,7 @@ package net.puzzlemc.splashscreen.mixin;
import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.LoadingOverlay; import net.minecraft.client.gui.screens.LoadingOverlay;
import net.minecraft.server.packs.resources.ReloadInstance; import net.minecraft.server.packs.resources.ReloadInstance;
import net.neoforged.fml.earlydisplay.DisplayWindow;
import net.neoforged.neoforge.client.loading.NeoForgeLoadingOverlay; import net.neoforged.neoforge.client.loading.NeoForgeLoadingOverlay;
import net.puzzlemc.core.config.PuzzleConfig; import net.puzzlemc.core.config.PuzzleConfig;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
@@ -21,8 +22,13 @@ public class MixinNeoForgeLoadingOverlay extends LoadingOverlay {
super(arg, arg2, consumer, bl); super(arg, arg2, consumer, bl);
} }
@Inject(method = "<init>", at = @At("TAIL"))
private void puzzle$initTexturesNeoforge(Minecraft mc, ReloadInstance reloader, Consumer<Optional<Throwable>> errorConsumer, DisplayWindow displayWindow, CallbackInfo ci) {
LoadingOverlay.registerTextures(/^? if >= 1.21.4 {^/ mc.getTextureManager() /^?} else {^/ /^mc ^//^?}^/);
}
@Inject(method = "render", at = @At("HEAD"), cancellable = true) // Replaces the NeoForge loading screen in later stages with the (customized) vanilla version @Inject(method = "render", at = @At("HEAD"), cancellable = true) // Replaces the NeoForge loading screen in later stages with the (customized) vanilla version
private void redirectNeoForgeLoading(GuiGraphics context, int mouseX, int mouseY, float tickDelta, CallbackInfo ci) { private void puzzle$redirectNeoForgeLoading(GuiGraphics context, int mouseX, int mouseY, float tickDelta, CallbackInfo ci) {
if (PuzzleConfig.resourcepackSplashScreen && PuzzleConfig.hasCustomSplashScreen) { if (PuzzleConfig.resourcepackSplashScreen && PuzzleConfig.hasCustomSplashScreen) {
super.render(context, mouseX, mouseY, tickDelta); super.render(context, mouseX, mouseY, tickDelta);
ci.cancel(); ci.cancel();

View File

@@ -30,7 +30,7 @@ import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.mojang.blaze3d.pipeline.RenderPipeline; import com.mojang.blaze3d.pipeline.RenderPipeline;
import net.minecraft.client.renderer.RenderPipelines; import net.minecraft.client.renderer.RenderPipelines;
//?} else if >= 1.21.5 { //?} else if >= 1.21.4 {
/*import net.minecraft.util.ARGB; /*import net.minecraft.util.ARGB;
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;
@@ -45,7 +45,7 @@ import static net.puzzlemc.core.PuzzleCore.LOGGER;
*///?} *///?}
import static net.puzzlemc.splashscreen.PuzzleSplashScreen.BACKGROUND; import static net.puzzlemc.splashscreen.PuzzleSplashScreen.BACKGROUND;
//? if >= 1.21.5 //? if >= 1.21.4
import static net.minecraft.client.gui.screens.LoadingOverlay.MOJANG_STUDIOS_LOGO_LOCATION; import static net.minecraft.client.gui.screens.LoadingOverlay.MOJANG_STUDIOS_LOGO_LOCATION;
@Mixin(value = LoadingOverlay.class, priority = 2000) @Mixin(value = LoadingOverlay.class, priority = 2000)
@@ -58,11 +58,11 @@ public abstract class MixinSplashScreen extends Overlay {
private static int replaceAlpha(int color, int alpha) { private static int replaceAlpha(int color, int alpha) {
return 0; return 0;
} }
//? if < 1.21.5 //? if < 1.21.4
/*@Shadow @Final static Identifier MOJANG_STUDIOS_LOGO_LOCATION;*/ /*@Shadow @Final static Identifier MOJANG_STUDIOS_LOGO_LOCATION;*/
@Inject(method = "registerTextures", at = @At("TAIL")) // Load our custom textures at game start // @Inject(method = "registerTextures", at = @At("TAIL")) // Load our custom textures at game start //
//? if >= 1.21.5 { //? if >= 1.21.4 {
private static void puzzle$initSplashscreen(TextureManager textureManager, CallbackInfo ci) { private static void puzzle$initSplashscreen(TextureManager textureManager, CallbackInfo ci) {
//?} else { //?} else {
/*private static void puzzle$initSplashscreen(Minecraft client, CallbackInfo ci) { /*private static void puzzle$initSplashscreen(Minecraft client, CallbackInfo ci) {
@@ -70,12 +70,12 @@ public abstract class MixinSplashScreen extends Overlay {
*///?} *///?}
if (PuzzleConfig.resourcepackSplashScreen) { if (PuzzleConfig.resourcepackSplashScreen) {
if (PuzzleSplashScreen.LOGO_TEXTURE.toFile().exists()) { if (PuzzleSplashScreen.LOGO_TEXTURE.toFile().exists()) {
textureManager./*? if >= 1.21.5 {*/ registerAndLoad /*?} else {*//*register*//*?}*/(MOJANG_STUDIOS_LOGO_LOCATION, new PuzzleSplashScreen.DynamicLogoTexture()); textureManager./*? if >= 1.21.4 {*/ registerAndLoad /*?} else {*//*register*//*?}*/(MOJANG_STUDIOS_LOGO_LOCATION, new PuzzleSplashScreen.DynamicLogoTexture());
} }
if (PuzzleSplashScreen.BACKGROUND_TEXTURE.toFile().exists()) { if (PuzzleSplashScreen.BACKGROUND_TEXTURE.toFile().exists()) {
try { try {
InputStream input = new FileInputStream(String.valueOf(PuzzleSplashScreen.BACKGROUND_TEXTURE)); InputStream input = new FileInputStream(String.valueOf(PuzzleSplashScreen.BACKGROUND_TEXTURE));
textureManager.register(BACKGROUND, new DynamicTexture(/*? if >= 1.21.5 {*/ () -> "splash_screen_background", /*?}*/ NativeImage.read(input))); textureManager.register(BACKGROUND, new DynamicTexture(/*? if >= 1.21.5 {*/ () ->"splash_screen_background", /*?}*/ NativeImage.read(input)));
} catch (IOException ignored) {} } catch (IOException ignored) {}
} }
} }
@@ -93,7 +93,7 @@ public abstract class MixinSplashScreen extends Overlay {
context.blit(PuzzleSplashScreen.CUSTOM_LOGO_PIPELINE, sprite, x, y, u, v, width, height, regionWidth, regionHeight, textureWidth, textureHeight, color); context.blit(PuzzleSplashScreen.CUSTOM_LOGO_PIPELINE, sprite, x, y, u, v, width, height, regionWidth, regionHeight, textureWidth, textureHeight, color);
else context.blit(pipeline, sprite, x, y, u, v, width, height, textureWidth, textureHeight, color); else context.blit(pipeline, sprite, x, y, u, v, width, height, textureWidth, textureHeight, color);
} }
//?} else if >= 1.21.5 { //?} else if >= 1.21.4 {
/*@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Ljava/util/function/Function;Lnet/minecraft/resources/Identifier;IIFFIIIIIII)V")) /*@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Ljava/util/function/Function;Lnet/minecraft/resources/Identifier;IIFFIIIIIII)V"))
private void puzzle$modifyRenderLayer(GuiGraphics context, Function<Identifier, RenderType> renderType, 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) { private void puzzle$modifyRenderLayer(GuiGraphics context, Function<Identifier, RenderType> renderType, 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) if (PuzzleConfig.resourcepackSplashScreen)
@@ -135,7 +135,7 @@ public abstract class MixinSplashScreen extends Overlay {
//? if >= 1.21.8 { //? if >= 1.21.8 {
context.blit(RenderPipelines.GUI_TEXTURED, BACKGROUND, 0, 0, 0, 0, width, height, width, height, ARGB.white(s)); context.blit(RenderPipelines.GUI_TEXTURED, BACKGROUND, 0, 0, 0, 0, width, height, width, height, ARGB.white(s));
//?} else if >= 1.21.5 { //?} else if >= 1.21.4 {
/*context.blit(RenderType::guiTextured, BACKGROUND, 0, 0, 0, 0, width, height, width, height, ARGB.white(s)); /*context.blit(RenderType::guiTextured, BACKGROUND, 0, 0, 0, 0, width, height, width, height, ARGB.white(s));
*///?} else { *///?} else {
/*RenderSystem.enableBlend(); /*RenderSystem.enableBlend();

View File

@@ -1,6 +1,6 @@
package net.puzzlemc.splashscreen.mixin; package net.puzzlemc.splashscreen.mixin;
//? if > 1.21.1 { //? if >= 1.21.5 {
import com.mojang.blaze3d.pipeline.RenderPipeline; import com.mojang.blaze3d.pipeline.RenderPipeline;
import net.minecraft.client.renderer.RenderPipelines; import net.minecraft.client.renderer.RenderPipelines;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;

View File

@@ -0,0 +1,16 @@
mod.mc_dep_fabric=>=1.21.3 <=1.21.4
mod.mc_dep_forgelike=[1.21.3,1.21.4]
mod.mc_title=1.21.4
mod.mc_targets=1.21.3 1.21.4
deps.forge_loader=0
deps.neoforge_loader=21.4.47-beta
deps.midnightlib_version=1.9.2+1.21.5-fabric
deps.fabric_version=0.119.4+1.21.4
deps.modmenu_version=13.0.3
jigsaws.emf_version=3.0.6-fabric-1.21.4
jigsaws.etf_version=7.0.6-fabric-1.21.4
loom.platform=fabric

View File

@@ -0,0 +1,16 @@
mod.mc_dep_fabric=>=1.21.3 <=1.21.4
mod.mc_dep_forgelike=[1.21.3,1.21.4]
mod.mc_title=1.21.4
mod.mc_targets=1.21.3 1.21.4
deps.forge_loader=0
deps.neoforge_loader=21.4.47-beta
deps.midnightlib_version=1.9.2+1.21.5-neoforge
deps.fabric_version=0.119.4+1.21.4
deps.modmenu_version=13.0.3
jigsaws.emf_version=3.0.6-neoforge-1.21.4
jigsaws.etf_version=7.0.6-neoforge-1.21.4
loom.platform=neoforge

View File

@@ -1,7 +1,7 @@
mod.mc_dep_fabric=>=1.21.4 <=1.21.5 mod.mc_dep_fabric==1.21.5
mod.mc_dep_forgelike=[1.21.4, 1.21.5] mod.mc_dep_forgelike=[1.21.5,]
mod.mc_title=1.21.5 mod.mc_title=1.21.5
mod.mc_targets=1.21.4 1.21.5 mod.mc_targets=1.21.5
deps.forge_loader=54.0.13 deps.forge_loader=54.0.13
deps.neoforge_loader=21.4.47-beta deps.neoforge_loader=21.4.47-beta

View File

@@ -1,5 +1,5 @@
mod.mc_dep_fabric=>=1.21.4 <=1.21.5 mod.mc_dep_fabric==1.21.5
mod.mc_dep_forgelike=[1.21.4, 1.21.5] mod.mc_dep_forgelike=[1.21.5,]
mod.mc_title=1.21.5 mod.mc_title=1.21.5
mod.mc_targets=1.21.4 1.21.5 mod.mc_targets=1.21.4 1.21.5