mirror of
https://github.com/PuzzleMC/Puzzle.git
synced 2025-12-15 19:35:10 +01:00
Puzzle 1.3.3 - Better Splashscreen
- Only apply puzzle-splashscreen when needed (fixes #34, fixes #8)
This commit is contained in:
@@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
|
||||
loader_version=0.14.6
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.3.2
|
||||
mod_version = 1.3.3
|
||||
maven_group = net.puzzlemc
|
||||
archives_base_name = puzzle
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ public class PuzzleConfig extends MidnightConfig {
|
||||
@Entry public static boolean checkUpdates = true;
|
||||
@Entry public static boolean showPuzzleInfo = true;
|
||||
@Entry public static boolean resourcepackSplashScreen = true;
|
||||
@Entry public static boolean betterSplashScreenBlend = true;
|
||||
@Entry public static boolean unlimitedRotations = true;
|
||||
@Entry public static boolean biggerModels = true;
|
||||
|
||||
@@ -21,4 +20,5 @@ public class PuzzleConfig extends MidnightConfig {
|
||||
@Entry public static int progressBarColor = 16777215;
|
||||
@Entry public static int progressBarBackgroundColor = 15675965;
|
||||
@Entry public static int progressFrameColor = 16777215;
|
||||
@Entry public static boolean disableBlend = false;
|
||||
}
|
||||
|
||||
@@ -54,10 +54,6 @@ public class PuzzleClient implements ClientModInitializer {
|
||||
PuzzleSplashScreen.resetColors();
|
||||
MinecraftClient.getInstance().getTextureManager().registerTexture(PuzzleSplashScreen.LOGO, new PuzzleSplashScreen.LogoTexture());
|
||||
}));
|
||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("puzzle.option.better_splash_screen_blend"), (button) -> button.setMessage(PuzzleConfig.betterSplashScreenBlend ? YES : NO), (button) -> {
|
||||
PuzzleConfig.betterSplashScreenBlend = !PuzzleConfig.betterSplashScreenBlend;
|
||||
PuzzleConfig.write(id);
|
||||
}));
|
||||
}
|
||||
if (FabricLoader.getInstance().isModLoaded("puzzle-models") && !PuzzleConfig.disabledIntegrations.contains("puzzle-models")) {
|
||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("puzzle.option.unlimited_model_rotations"), (button) -> button.setMessage(PuzzleConfig.unlimitedRotations ? YES : NO), (button) -> {
|
||||
|
||||
@@ -43,6 +43,7 @@ public class PuzzleSplashScreen implements ClientModInitializer {
|
||||
PuzzleConfig.progressBarColor = 16777215;
|
||||
PuzzleConfig.progressBarBackgroundColor = 15675965;
|
||||
PuzzleConfig.progressFrameColor = 16777215;
|
||||
PuzzleConfig.disableBlend = false;
|
||||
PuzzleConfig.write("puzzle");
|
||||
}
|
||||
|
||||
@@ -89,9 +90,11 @@ public class PuzzleSplashScreen implements ClientModInitializer {
|
||||
if (properties.get("screen.loading.outline") != null) {
|
||||
PuzzleConfig.progressFrameColor = MidnightColorUtil.hex2Rgb(properties.get("screen.loading.outline").toString()).getRGB();
|
||||
}
|
||||
if (properties.get("screen.loading") != null) {
|
||||
PuzzleConfig.write("puzzle");
|
||||
if (properties.get("screen.loading.blend") != null) {
|
||||
PuzzleConfig.disableBlend = properties.get("screen.loading.blend").toString().equals("off");
|
||||
PuzzleConfig.progressFrameColor = MidnightColorUtil.hex2Rgb(properties.get("screen.loading.outline").toString()).getRGB();
|
||||
}
|
||||
PuzzleConfig.write("puzzle");
|
||||
} catch (Exception e) {
|
||||
LogManager.getLogger("Puzzle").error("Error occurred while loading color.properties " + id.toString(), e);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,11 @@ public abstract class MixinSplashScreen extends Overlay {
|
||||
@Shadow @Final static Identifier LOGO;
|
||||
@Shadow private long reloadCompleteTime;
|
||||
|
||||
@Shadow
|
||||
private static int withAlpha(int color, int alpha) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Inject(method = "init(Lnet/minecraft/client/MinecraftClient;)V", at = @At("TAIL"))
|
||||
private static void puzzle$initSplashscreen(MinecraftClient client, CallbackInfo ci) { // Load our custom textures at game start //
|
||||
if (PuzzleConfig.resourcepackSplashScreen && PuzzleSplashScreen.LOGO_TEXTURE.toFile().exists()) {
|
||||
@@ -39,11 +44,11 @@ public abstract class MixinSplashScreen extends Overlay {
|
||||
}
|
||||
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Ljava/util/function/IntSupplier;getAsInt()I"))
|
||||
private int puzzle$modifyBackground(IntSupplier instance) { // Set the Progress Bar Frame Color to our configured value //
|
||||
return PuzzleConfig.backgroundColor | 255 << 24;
|
||||
return (!PuzzleConfig.resourcepackSplashScreen || PuzzleConfig.progressBarBackgroundColor == 15675965) ? instance.getAsInt() : PuzzleConfig.backgroundColor | 255 << 24;
|
||||
}
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;blendFunc(II)V", shift = At.Shift.AFTER), remap = false)
|
||||
private void puzzle$betterBlend(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
if (PuzzleConfig.betterSplashScreenBlend) RenderSystem.defaultBlendFunc();
|
||||
if (PuzzleConfig.disableBlend) RenderSystem.defaultBlendFunc();
|
||||
}
|
||||
@Inject(method = "renderProgressBar", at = @At("HEAD"))
|
||||
private void puzzle$addProgressBarBackground(MatrixStack matrices, int minX, int minY, int maxX, int maxY, float opacity, CallbackInfo ci) {
|
||||
@@ -65,14 +70,10 @@ public abstract class MixinSplashScreen extends Overlay {
|
||||
|
||||
@ModifyArg(method = "renderProgressBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/SplashOverlay;fill(Lnet/minecraft/client/util/math/MatrixStack;IIIII)V"), index = 5)
|
||||
private int puzzle$modifyProgressFrame(int color) { // Set the Progress Bar Frame Color to our configured value //
|
||||
return PuzzleConfig.progressFrameColor | 255 << 24;
|
||||
return (!PuzzleConfig.resourcepackSplashScreen || PuzzleConfig.progressFrameColor == 16777215) ? color : PuzzleConfig.progressFrameColor | 255 << 24;
|
||||
}
|
||||
@ModifyArg(method = "renderProgressBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/SplashOverlay;fill(Lnet/minecraft/client/util/math/MatrixStack;IIIII)V", ordinal = 4), index = 5)
|
||||
private int puzzle$modifyProgressColor(int color) { // Set the Progress Bar Color to our configured value //
|
||||
return PuzzleConfig.progressBarColor | 255 << 24;
|
||||
return (!PuzzleConfig.resourcepackSplashScreen || PuzzleConfig.progressBarColor == 16777215) ? color : PuzzleConfig.progressBarColor | 255 << 24;
|
||||
}
|
||||
private static int withAlpha(int color, int alpha) {
|
||||
return color & 0xFFFFFF | alpha << 24;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user