mirror of
https://github.com/PuzzleMC/Puzzle.git
synced 2025-12-15 19:35:10 +01:00
port: Spring to Life (1.21.5)
This commit is contained in:
@@ -3,7 +3,7 @@ import groovy.json.JsonOutput
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "architectury-plugin" version "3.4-SNAPSHOT"
|
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 "me.shedaniel.unified-publishing" version "0.1.+" apply false
|
||||||
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public class PuzzleSplashScreen {
|
|||||||
try (InputStream stream = resource.getInputStream()) {
|
try (InputStream stream = resource.getInputStream()) {
|
||||||
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().registerTexture(BACKGROUND, new NativeImageBackedTexture(NativeImage.read(input)));
|
client.getTextureManager().registerTexture(BACKGROUND, new NativeImageBackedTexture(() -> "splash_screen_background", NativeImage.read(input)));
|
||||||
keepBackground = true;
|
keepBackground = true;
|
||||||
PuzzleConfig.hasCustomSplashScreen = true;
|
PuzzleConfig.hasCustomSplashScreen = true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package net.puzzlemc.splashscreen.mixin;
|
package net.puzzlemc.splashscreen.mixin;
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.opengl.GlStateManager;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
@@ -16,6 +16,7 @@ import net.minecraft.util.math.ColorHelper;
|
|||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.puzzlemc.core.config.PuzzleConfig;
|
import net.puzzlemc.core.config.PuzzleConfig;
|
||||||
import net.puzzlemc.splashscreen.PuzzleSplashScreen;
|
import net.puzzlemc.splashscreen.PuzzleSplashScreen;
|
||||||
|
import net.puzzlemc.splashscreen.util.BlendFactors;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
@@ -52,7 +53,7 @@ public abstract class MixinSplashScreen extends Overlay {
|
|||||||
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.registerTexture(BACKGROUND, new NativeImageBackedTexture(NativeImage.read(input)));
|
textureManager.registerTexture(BACKGROUND, new NativeImageBackedTexture(() -> "splash_screen_background", NativeImage.read(input)));
|
||||||
} catch (IOException ignored) {}
|
} 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))
|
@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) {
|
private void puzzle$betterBlend(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||||
if (PuzzleConfig.resourcepackSplashScreen) {
|
if (PuzzleConfig.resourcepackSplashScreen) {
|
||||||
if (PuzzleConfig.disableBlend) RenderSystem.disableBlend();
|
if (PuzzleConfig.disableBlend) GlStateManager._disableBlend();
|
||||||
else if (PuzzleConfig.customBlendFunction.size() == 4) {
|
else if (PuzzleConfig.customBlendFunction.size() == 4) {
|
||||||
try {
|
try {
|
||||||
RenderSystem.blendFuncSeparate(
|
GlStateManager._blendFuncSeparate(
|
||||||
GlStateManager.SrcFactor.valueOf(PuzzleConfig.customBlendFunction.get(0)),
|
BlendFactors.SrcFactor.valueFromString(PuzzleConfig.customBlendFunction.get(0)),
|
||||||
GlStateManager.DstFactor.valueOf(PuzzleConfig.customBlendFunction.get(1)),
|
BlendFactors.DstFactor.valueFromString(PuzzleConfig.customBlendFunction.get(1)),
|
||||||
GlStateManager.SrcFactor.valueOf(PuzzleConfig.customBlendFunction.get(2)),
|
BlendFactors.SrcFactor.valueFromString(PuzzleConfig.customBlendFunction.get(2)),
|
||||||
GlStateManager.DstFactor.valueOf(PuzzleConfig.customBlendFunction.get(3)));
|
BlendFactors.DstFactor.valueFromString(PuzzleConfig.customBlendFunction.get(3)));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Incorrect blend function defined in color.properties: {}{}", PuzzleConfig.customBlendFunction, e.getMessage());
|
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);
|
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 if (reloading) s = MathHelper.clamp(g, 0.0F, 1.0F);
|
||||||
else s = 1.0F;
|
else s = 1.0F;
|
||||||
RenderSystem.enableBlend();
|
//GlStateManager._enableBlend();
|
||||||
RenderSystem.blendEquation(32774);
|
//GlStateManager.blendEquation(32774);
|
||||||
RenderSystem.defaultBlendFunc();
|
//GlStateManager._defaultBlendFunc();
|
||||||
context.getMatrices().translate(0, 0, 1f);
|
context.getMatrices().translate(0, 0, 1f);
|
||||||
context.drawTexture(RenderLayer::getGuiTextured, BACKGROUND, 0, 0, 0, 0, width, height, width, height, ColorHelper.getWhite(s));
|
context.drawTexture(RenderLayer::getGuiTextured, BACKGROUND, 0, 0, 0, 0, width, height, width, height, ColorHelper.getWhite(s));
|
||||||
RenderSystem.defaultBlendFunc();
|
//RenderSystem._defaultBlendFunc();
|
||||||
RenderSystem.disableBlend();
|
//RenderSystem._disableBlend();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Inject(method = "renderProgressBar", at = @At("HEAD"))
|
@Inject(method = "renderProgressBar", at = @At("HEAD"))
|
||||||
@@ -107,7 +108,7 @@ public abstract class MixinSplashScreen extends Overlay {
|
|||||||
long l = Util.getMeasuringTimeMs();
|
long l = Util.getMeasuringTimeMs();
|
||||||
float f = this.reloadCompleteTime > -1L ? (float)(l - this.reloadCompleteTime) / 1000.0F : -1.0F;
|
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);
|
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));
|
context.fill(minX, minY, maxX, maxY, withAlpha(PuzzleConfig.progressBarBackgroundColor, m));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
# Done to increase the memory available to gradle.
|
# Done to increase the memory available to gradle.
|
||||||
org.gradle.jvmargs=-Xmx2G
|
org.gradle.jvmargs=-Xmx2G
|
||||||
|
|
||||||
minecraft_version=1.21.4
|
minecraft_version=1.21.5
|
||||||
supported_versions=
|
supported_versions=
|
||||||
yarn_mappings=1.21.4+build.1
|
yarn_mappings=1.21.5+build.1
|
||||||
enabled_platforms=fabric,neoforge
|
enabled_platforms=fabric,neoforge
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 2.0.4
|
mod_version = 2.0.5
|
||||||
maven_group = net.puzzlemc
|
maven_group = net.puzzlemc
|
||||||
archives_base_name = puzzle
|
archives_base_name = puzzle
|
||||||
release_type=release
|
release_type=release
|
||||||
@@ -15,14 +15,14 @@ curseforge_id=563977
|
|||||||
modrinth_id=3IuO68q1
|
modrinth_id=3IuO68q1
|
||||||
|
|
||||||
# Modloaders
|
# Modloaders
|
||||||
fabric_loader_version=0.16.9
|
fabric_loader_version=0.16.10
|
||||||
fabric_api_version=0.110.5+1.21.4
|
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
|
yarn_mappings_patch_neoforge_version = 1.21+build.4
|
||||||
|
|
||||||
# Libraries
|
# Libraries
|
||||||
midnightlib_version = 1.6.6
|
midnightlib_version = 1.6.11+1.21.4
|
||||||
modmenu_version = 13.0.0-beta.1
|
modmenu_version = 13.0.0-beta.1
|
||||||
|
|
||||||
# Mod Integrations
|
# Mod Integrations
|
||||||
@@ -39,8 +39,8 @@ toml4j_version = 0.7.2
|
|||||||
cit_resewn_version = 1.1.3+1.20
|
cit_resewn_version = 1.1.3+1.20
|
||||||
complete_config_version = 2.3.0
|
complete_config_version = 2.3.0
|
||||||
spruceui_version=5.0.0+1.20
|
spruceui_version=5.0.0+1.20
|
||||||
emf_version=2.2.3
|
emf_version=2.4.1
|
||||||
etf_version=6.2.2
|
etf_version=6.2.10
|
||||||
exordium_version=1.2.1-1.20.2
|
exordium_version=1.2.1-1.20.2
|
||||||
# Required for LBG
|
# Required for LBG
|
||||||
quilt_loader_version=0.19.0-beta.18
|
quilt_loader_version=0.19.0-beta.18
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
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
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
Reference in New Issue
Block a user