port: Spring to Life (1.21.5)

This commit is contained in:
Martin Prokoph
2025-03-26 19:48:18 +01:00
parent fbac443231
commit b73c28d48d
6 changed files with 85 additions and 26 deletions

View File

@@ -3,7 +3,7 @@ import groovy.json.JsonOutput
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.10-SNAPSHOT" apply false
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
}

View File

@@ -107,7 +107,7 @@ public class PuzzleSplashScreen {
try (InputStream stream = resource.getInputStream()) {
Files.copy(stream, BACKGROUND_TEXTURE, StandardCopyOption.REPLACE_EXISTING);
InputStream input = new FileInputStream(String.valueOf(PuzzleSplashScreen.BACKGROUND_TEXTURE));
client.getTextureManager().registerTexture(BACKGROUND, new NativeImageBackedTexture(NativeImage.read(input)));
client.getTextureManager().registerTexture(BACKGROUND, new NativeImageBackedTexture(() -> "splash_screen_background", NativeImage.read(input)));
keepBackground = true;
PuzzleConfig.hasCustomSplashScreen = true;
} catch (Exception e) {

View File

@@ -1,6 +1,6 @@
package net.puzzlemc.splashscreen.mixin;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.opengl.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
@@ -16,6 +16,7 @@ import net.minecraft.util.math.ColorHelper;
import net.minecraft.util.math.MathHelper;
import net.puzzlemc.core.config.PuzzleConfig;
import net.puzzlemc.splashscreen.PuzzleSplashScreen;
import net.puzzlemc.splashscreen.util.BlendFactors;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -52,7 +53,7 @@ public abstract class MixinSplashScreen extends Overlay {
if (PuzzleSplashScreen.BACKGROUND_TEXTURE.toFile().exists()) {
try {
InputStream input = new FileInputStream(String.valueOf(PuzzleSplashScreen.BACKGROUND_TEXTURE));
textureManager.registerTexture(BACKGROUND, new NativeImageBackedTexture(NativeImage.read(input)));
textureManager.registerTexture(BACKGROUND, new NativeImageBackedTexture(() -> "splash_screen_background", NativeImage.read(input)));
} catch (IOException ignored) {}
}
}
@@ -65,14 +66,14 @@ public abstract class MixinSplashScreen extends Overlay {
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/ColorHelper;getWhite(F)I", shift = At.Shift.AFTER))
private void puzzle$betterBlend(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
if (PuzzleConfig.resourcepackSplashScreen) {
if (PuzzleConfig.disableBlend) RenderSystem.disableBlend();
if (PuzzleConfig.disableBlend) GlStateManager._disableBlend();
else if (PuzzleConfig.customBlendFunction.size() == 4) {
try {
RenderSystem.blendFuncSeparate(
GlStateManager.SrcFactor.valueOf(PuzzleConfig.customBlendFunction.get(0)),
GlStateManager.DstFactor.valueOf(PuzzleConfig.customBlendFunction.get(1)),
GlStateManager.SrcFactor.valueOf(PuzzleConfig.customBlendFunction.get(2)),
GlStateManager.DstFactor.valueOf(PuzzleConfig.customBlendFunction.get(3)));
GlStateManager._blendFuncSeparate(
BlendFactors.SrcFactor.valueFromString(PuzzleConfig.customBlendFunction.get(0)),
BlendFactors.DstFactor.valueFromString(PuzzleConfig.customBlendFunction.get(1)),
BlendFactors.SrcFactor.valueFromString(PuzzleConfig.customBlendFunction.get(2)),
BlendFactors.DstFactor.valueFromString(PuzzleConfig.customBlendFunction.get(3)));
} catch (Exception e) {
LOGGER.error("Incorrect blend function defined in color.properties: {}{}", PuzzleConfig.customBlendFunction, e.getMessage());
}
@@ -91,13 +92,13 @@ 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;
RenderSystem.enableBlend();
RenderSystem.blendEquation(32774);
RenderSystem.defaultBlendFunc();
//GlStateManager._enableBlend();
//GlStateManager.blendEquation(32774);
//GlStateManager._defaultBlendFunc();
context.getMatrices().translate(0, 0, 1f);
context.drawTexture(RenderLayer::getGuiTextured, BACKGROUND, 0, 0, 0, 0, width, height, width, height, ColorHelper.getWhite(s));
RenderSystem.defaultBlendFunc();
RenderSystem.disableBlend();
//RenderSystem._defaultBlendFunc();
//RenderSystem._disableBlend();
}
}
@Inject(method = "renderProgressBar", at = @At("HEAD"))
@@ -107,7 +108,7 @@ public abstract class MixinSplashScreen extends Overlay {
long l = Util.getMeasuringTimeMs();
float f = this.reloadCompleteTime > -1L ? (float)(l - this.reloadCompleteTime) / 1000.0F : -1.0F;
int m = MathHelper.ceil((1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F)) * 255.0F);
RenderSystem.disableBlend();
//RenderSystem.disableBlend();
context.fill(minX, minY, maxX, maxY, withAlpha(PuzzleConfig.progressBarBackgroundColor, m));
}

View File

@@ -0,0 +1,58 @@
package net.puzzlemc.splashscreen.util;
public abstract class BlendFactors {
public enum SrcFactor {
CONSTANT_ALPHA(32771),
CONSTANT_COLOR(32769),
DST_ALPHA(772),
DST_COLOR(774),
ONE(1),
ONE_MINUS_CONSTANT_ALPHA(32772),
ONE_MINUS_CONSTANT_COLOR(32770),
ONE_MINUS_DST_ALPHA(773),
ONE_MINUS_DST_COLOR(775),
ONE_MINUS_SRC_ALPHA(771),
ONE_MINUS_SRC_COLOR(769),
SRC_ALPHA(770),
SRC_ALPHA_SATURATE(776),
SRC_COLOR(768),
ZERO(0);
public final int value;
public static int valueFromString(String input) throws IllegalArgumentException {
return SrcFactor.valueOf(input).value;
}
SrcFactor(final int value) {
this.value = value;
}
}
public enum DstFactor {
CONSTANT_ALPHA(32771),
CONSTANT_COLOR(32769),
DST_ALPHA(772),
DST_COLOR(774),
ONE(1),
ONE_MINUS_CONSTANT_ALPHA(32772),
ONE_MINUS_CONSTANT_COLOR(32770),
ONE_MINUS_DST_ALPHA(773),
ONE_MINUS_DST_COLOR(775),
ONE_MINUS_SRC_ALPHA(771),
ONE_MINUS_SRC_COLOR(769),
SRC_ALPHA(770),
SRC_COLOR(768),
ZERO(0);
public final int value;
public static int valueFromString(String input) throws IllegalArgumentException {
return DstFactor.valueOf(input).value;
}
DstFactor(final int value) {
this.value = value;
}
}
}

View File

@@ -1,13 +1,13 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx2G
minecraft_version=1.21.4
minecraft_version=1.21.5
supported_versions=
yarn_mappings=1.21.4+build.1
yarn_mappings=1.21.5+build.1
enabled_platforms=fabric,neoforge
# Mod Properties
mod_version = 2.0.4
mod_version = 2.0.5
maven_group = net.puzzlemc
archives_base_name = puzzle
release_type=release
@@ -15,14 +15,14 @@ curseforge_id=563977
modrinth_id=3IuO68q1
# Modloaders
fabric_loader_version=0.16.9
fabric_api_version=0.110.5+1.21.4
fabric_loader_version=0.16.10
fabric_api_version=0.119.5+1.21.5
neoforge_version=21.4.9-beta
neoforge_version=21.5.0-beta
yarn_mappings_patch_neoforge_version = 1.21+build.4
# Libraries
midnightlib_version = 1.6.6
midnightlib_version = 1.6.11+1.21.4
modmenu_version = 13.0.0-beta.1
# Mod Integrations
@@ -39,8 +39,8 @@ toml4j_version = 0.7.2
cit_resewn_version = 1.1.3+1.20
complete_config_version = 2.3.0
spruceui_version=5.0.0+1.20
emf_version=2.2.3
etf_version=6.2.2
emf_version=2.4.1
etf_version=6.2.10
exordium_version=1.2.1-1.20.2
# Required for LBG
quilt_loader_version=0.19.0-beta.18

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists