Puzzle 0.4.0 - 1.17.1, more mods supported, Text and Slider fields

This commit is contained in:
Motschen
2021-09-26 14:19:13 +02:00
parent f28f2cd38b
commit 14f63e2758
20 changed files with 239 additions and 460 deletions

View File

@@ -1,7 +1,7 @@
package net.puzzlemc.splashscreen.mixin;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.SplashScreen;
import net.minecraft.client.gui.screen.SplashOverlay;
import net.minecraft.util.Identifier;
import net.minecraft.util.Util;
import net.minecraft.util.math.MathHelper;
@@ -16,7 +16,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(value = SplashScreen.class, priority = 2000)
@Mixin(value = SplashOverlay.class, priority = 2000)
public class MixinSplashScreen {
@Shadow @Final static Identifier LOGO;
@Shadow @Final private boolean reloading;
@@ -27,7 +27,7 @@ public class MixinSplashScreen {
private static void init(MinecraftClient client, CallbackInfo ci) { // Load our custom textures at game start //
if (PuzzleConfig.resourcepackSplashScreen && PuzzleSplashScreen.LOGO_TEXTURE.toFile().exists()) client.getTextureManager().registerTexture(LOGO, new ConfigTexture(LOGO));
}
@ModifyArg(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/SplashScreen;fill(Lnet/minecraft/client/util/math/MatrixStack;IIIII)V"), index = 5)
//@ModifyArg(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/SplashScreen;fill(Lnet/minecraft/client/util/math/MatrixStack;IIIII)V"), index = 5)
private int modifyBackgroundColor(int color) { // Set the Background Color to our configured value //
long l = Util.getMeasuringTimeMs();
if (this.reloading && this.reloadStartTime == -1L) {
@@ -40,11 +40,11 @@ public class MixinSplashScreen {
return PuzzleConfig.backgroundColor | m << 24;
}
@ModifyArg(method = "renderProgressBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/SplashScreen;fill(Lnet/minecraft/client/util/math/MatrixStack;IIIII)V"), index = 5)
//@ModifyArg(method = "renderProgressBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/SplashScreen;fill(Lnet/minecraft/client/util/math/MatrixStack;IIIII)V"), index = 5)
private int modifyProgressFrame(int color) { // Set the Progress Bar Frame Color to our configured value //
return PuzzleConfig.progressFrameColor | 255 << 24;
}
@ModifyArg(method = "renderProgressBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/SplashScreen;fill(Lnet/minecraft/client/util/math/MatrixStack;IIIII)V", ordinal = 4), index = 5)
//@ModifyArg(method = "renderProgressBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/SplashScreen;fill(Lnet/minecraft/client/util/math/MatrixStack;IIIII)V", ordinal = 4), index = 5)
private int modifyProgressColor(int color) { // Set the Progress Bar Color to our configured value //
return PuzzleConfig.progressBarColor | 255 << 24;
}