mirror of
https://github.com/PuzzleMC/Puzzle.git
synced 2025-12-15 19:35:10 +01:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
795759b4e5 | ||
|
|
2410b8ff54 | ||
|
|
d08889f186 | ||
|
|
2886fd509b | ||
|
|
8be9fc6872 | ||
|
|
87ebfdd3b6 |
@@ -124,7 +124,7 @@ dependencies {
|
||||
modImplementation ("maven.modrinth:lambdynamiclights:${project.ldl_version}")
|
||||
modImplementation ("maven.modrinth:lambdabettergrass:${project.lbg_version}")
|
||||
modImplementation ("maven.modrinth:iris:${project.iris_version}")
|
||||
modImplementation ("maven.modrinth:cit-resewn:${project.cit_resewn_version}")
|
||||
modCompileOnly ("maven.modrinth:cit-resewn:${project.cit_resewn_version}")
|
||||
modImplementation ("maven.modrinth:continuity:${project.continuity_version}")
|
||||
modImplementation ("maven.modrinth:animatica:${project.animatica_version}")
|
||||
modImplementation ("maven.modrinth:entitytexturefeatures:${project.entitytexturefeatures_version}")
|
||||
|
||||
@@ -4,28 +4,28 @@ org.gradle.jvmargs=-Xmx1G
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/use
|
||||
minecraft_version=1.19
|
||||
yarn_mappings=1.19+build.1
|
||||
loader_version=0.14.6
|
||||
yarn_mappings=1.19+build.4
|
||||
loader_version=0.14.8
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.3.2
|
||||
mod_version = 1.3.4
|
||||
maven_group = net.puzzlemc
|
||||
archives_base_name = puzzle
|
||||
|
||||
# Dependencies
|
||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
||||
fabric_version=0.55.1+1.19
|
||||
mod_menu_version = 2.0.13
|
||||
fabric_version=0.57.0+1.19
|
||||
mod_menu_version = 4.0.0
|
||||
|
||||
cull_leaves_version = 2.3.3
|
||||
ldl_version = 2.1.0+1.17
|
||||
lbg_version = 1.2.3+1.18
|
||||
iris_version = 1.18.x-v1.2.4
|
||||
continuity_version = 1.0.3+1.18
|
||||
animatica_version = 0.2+1.18
|
||||
ldl_version = 2.1.2+1.19
|
||||
lbg_version = 1.3.0+1.19
|
||||
iris_version = 1.19.x-v1.2.5
|
||||
continuity_version = 2.0.0+1.19
|
||||
animatica_version = 0.5+1.19
|
||||
cit_resewn_version = 1.0.1+1.18.2
|
||||
cem_version = 0.7.1
|
||||
cem_version = 0.7.1-1.19
|
||||
complete_config_version = 1.0.0
|
||||
spruceui_version=3.3.3+1.18
|
||||
spruceui_version=4.0.0+1.19
|
||||
midnightlib_version=0.5.2
|
||||
entitytexturefeatures_version=3.0.0
|
||||
entitytexturefeatures_version=3.1.5
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -52,11 +52,7 @@ public class PuzzleClient implements ClientModInitializer {
|
||||
PuzzleConfig.resourcepackSplashScreen = !PuzzleConfig.resourcepackSplashScreen;
|
||||
PuzzleConfig.write(id);
|
||||
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);
|
||||
MinecraftClient.getInstance().getTextureManager().registerTexture(PuzzleSplashScreen.LOGO, new PuzzleSplashScreen.LogoTexture(PuzzleSplashScreen.LOGO));
|
||||
}));
|
||||
}
|
||||
if (FabricLoader.getInstance().isModLoaded("puzzle-models") && !PuzzleConfig.disabledIntegrations.contains("puzzle-models")) {
|
||||
|
||||
@@ -34,15 +34,19 @@ import java.util.Properties;
|
||||
|
||||
public class PuzzleSplashScreen implements ClientModInitializer {
|
||||
public static final Identifier LOGO = new Identifier("textures/gui/title/mojangstudios.png");
|
||||
public static final Identifier BACKGROUND = new Identifier("optifine/splash_background.png");
|
||||
public static File CONFIG_PATH = new File(String.valueOf(FabricLoader.getInstance().getConfigDir().resolve(".puzzle_cache")));
|
||||
public static Path LOGO_TEXTURE = Paths.get(CONFIG_PATH + "/mojangstudios.png");
|
||||
public static Path BACKGROUND_TEXTURE = Paths.get(CONFIG_PATH + "/splash_background.png");
|
||||
private static final MinecraftClient client = MinecraftClient.getInstance();
|
||||
private static boolean keepBackground = true;
|
||||
|
||||
public static void resetColors() {
|
||||
PuzzleConfig.backgroundColor = 15675965;
|
||||
PuzzleConfig.progressBarColor = 16777215;
|
||||
PuzzleConfig.progressBarBackgroundColor = 15675965;
|
||||
PuzzleConfig.progressFrameColor = 16777215;
|
||||
PuzzleConfig.disableBlend = false;
|
||||
PuzzleConfig.write("puzzle");
|
||||
}
|
||||
|
||||
@@ -70,7 +74,8 @@ public class PuzzleSplashScreen implements ClientModInitializer {
|
||||
public void reload(ResourceManager manager) {
|
||||
if (PuzzleConfig.resourcepackSplashScreen) {
|
||||
PuzzleSplashScreen.resetColors();
|
||||
client.getTextureManager().registerTexture(LOGO, new LogoTexture());
|
||||
client.getTextureManager().registerTexture(LOGO, new LogoTexture(LOGO));
|
||||
client.getTextureManager().registerTexture(BACKGROUND, new LogoTexture(BACKGROUND));
|
||||
|
||||
manager.findResources("optifine", path -> path.getPath().contains("color.properties")).forEach((id, resource) -> {
|
||||
try (InputStream stream = manager.getResource(id).get().getInputStream()) {
|
||||
@@ -89,9 +94,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);
|
||||
}
|
||||
@@ -99,23 +106,35 @@ public class PuzzleSplashScreen implements ClientModInitializer {
|
||||
manager.findResources("textures", path -> path.getPath().contains("mojangstudios.png")).forEach((id, resource) -> {
|
||||
try (InputStream stream = manager.getResource(id).get().getInputStream()) {
|
||||
Files.copy(stream, LOGO_TEXTURE, StandardCopyOption.REPLACE_EXISTING);
|
||||
DefaultResourcePack defaultResourcePack = client.getResourcePackProvider().getPack();
|
||||
InputStream defaultLogo = defaultResourcePack.open(ResourceType.CLIENT_RESOURCES, LOGO);
|
||||
InputStream input = new FileInputStream(String.valueOf(PuzzleSplashScreen.LOGO_TEXTURE));
|
||||
if (input != defaultLogo)
|
||||
client.getTextureManager().registerTexture(LOGO, new NativeImageBackedTexture(NativeImage.read(input)));
|
||||
else Files.delete(LOGO_TEXTURE);
|
||||
} catch (Exception e) {
|
||||
LogManager.getLogger("Puzzle").error("Error occurred while loading custom minecraft logo " + id.toString(), e);
|
||||
}
|
||||
});
|
||||
manager.findResources("puzzle", path -> path.getPath().contains("splash_background.png")).forEach((id, resource) -> {
|
||||
try (InputStream stream = manager.getResource(id).get().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)));
|
||||
keepBackground = true;
|
||||
} catch (Exception e) {
|
||||
LogManager.getLogger("Puzzle").error("Error occurred while loading custom splash background " + id.toString(), e);
|
||||
}
|
||||
});
|
||||
if (!keepBackground) {
|
||||
try {
|
||||
Files.delete(BACKGROUND_TEXTURE);
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
keepBackground = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@Environment(EnvType.CLIENT)
|
||||
public static class LogoTexture extends ResourceTexture {
|
||||
public LogoTexture() { super(LOGO); }
|
||||
public LogoTexture(Identifier logo) { super(logo); }
|
||||
|
||||
protected TextureData loadTextureData(ResourceManager resourceManager) {
|
||||
MinecraftClient minecraftClient = MinecraftClient.getInstance();
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.Overlay;
|
||||
import net.minecraft.client.gui.screen.SplashOverlay;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
import net.minecraft.client.texture.NativeImage;
|
||||
import net.minecraft.client.texture.NativeImageBackedTexture;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
@@ -21,6 +22,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.util.function.IntSupplier;
|
||||
|
||||
@Mixin(value = SplashOverlay.class, priority = 2000)
|
||||
@@ -28,22 +30,69 @@ 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;
|
||||
}
|
||||
|
||||
@Shadow @Final private MinecraftClient client;
|
||||
|
||||
@Shadow @Final private boolean reloading;
|
||||
|
||||
@Shadow private long reloadStartTime;
|
||||
|
||||
@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()) {
|
||||
try {
|
||||
InputStream input = new FileInputStream(String.valueOf(PuzzleSplashScreen.LOGO_TEXTURE));
|
||||
client.getTextureManager().registerTexture(LOGO, new NativeImageBackedTexture(NativeImage.read(input)));
|
||||
} catch (IOException ignored) {}
|
||||
if (PuzzleConfig.resourcepackSplashScreen) {
|
||||
if (PuzzleSplashScreen.LOGO_TEXTURE.toFile().exists()) {
|
||||
try {
|
||||
InputStream input = new FileInputStream(String.valueOf(PuzzleSplashScreen.LOGO_TEXTURE));
|
||||
client.getTextureManager().registerTexture(LOGO, new NativeImageBackedTexture(NativeImage.read(input)));
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
if (PuzzleSplashScreen.BACKGROUND_TEXTURE.toFile().exists()) {
|
||||
try {
|
||||
InputStream input = new FileInputStream(String.valueOf(PuzzleSplashScreen.BACKGROUND_TEXTURE));
|
||||
client.getTextureManager().registerTexture(PuzzleSplashScreen.BACKGROUND, new NativeImageBackedTexture(NativeImage.read(input)));
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@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 = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/Window;getScaledWidth()I", shift = At.Shift.BEFORE))
|
||||
private void puzzle$renderSplashBackground(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
if (Files.exists(PuzzleSplashScreen.BACKGROUND_TEXTURE)) {
|
||||
int width = client.getWindow().getScaledWidth();
|
||||
int height = client.getWindow().getScaledHeight();
|
||||
long l = Util.getMeasuringTimeMs();
|
||||
float f = this.reloadCompleteTime > -1L ? (float)(l - this.reloadCompleteTime) / 1000.0F : -1.0F;
|
||||
float g = this.reloadStartTime> -1L ? (float)(l - this.reloadStartTime) / 500.0F : -1.0F;
|
||||
float s;
|
||||
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.setShaderTexture(0, PuzzleSplashScreen.BACKGROUND);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendEquation(32774);
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, s);
|
||||
drawTexture(matrices, 0, 0, 0, 0, 0, width, height, width, height);
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
}
|
||||
@Inject(method = "renderProgressBar", at = @At("HEAD"))
|
||||
private void puzzle$addProgressBarBackground(MatrixStack matrices, int minX, int minY, int maxX, int maxY, float opacity, CallbackInfo ci) {
|
||||
@@ -54,25 +103,13 @@ public abstract class MixinSplashScreen extends Overlay {
|
||||
int m = MathHelper.ceil((1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F)) * 255.0F);
|
||||
fill(matrices, minX, minY, maxX, maxY, withAlpha(PuzzleConfig.progressBarBackgroundColor, m));
|
||||
}
|
||||
@Inject(method = "renderProgressBar", at = @At("TAIL"))
|
||||
private void puzzle$fixProgressBarEnd(MatrixStack matrices, int minX, int minY, int maxX, int maxY, float opacity, CallbackInfo ci) { // For some reason the end of the progressbar is colored wrong
|
||||
if (!PuzzleConfig.resourcepackSplashScreen || PuzzleConfig.progressFrameColor == 16777215) return;
|
||||
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);
|
||||
fill(matrices, maxX-1, minY, maxX, maxY, withAlpha(PuzzleConfig.progressFrameColor, m));
|
||||
}
|
||||
|
||||
@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)
|
||||
@ModifyArg(method = "renderProgressBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/SplashOverlay;fill(Lnet/minecraft/client/util/math/MatrixStack;IIIII)V", ordinal = 0), 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BIN
puzzle-splashscreen_example_pack.zip
Normal file
BIN
puzzle-splashscreen_example_pack.zip
Normal file
Binary file not shown.
17
src/main/resources/assets/puzzle/lang/ko_kr.json
Normal file
17
src/main/resources/assets/puzzle/lang/ko_kr.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"puzzle.text.update_available":"업데이트가 가능합니다!",
|
||||
"puzzle.screen.title":"Puzzle 설정",
|
||||
"puzzle.page.graphics":"그래픽 설정",
|
||||
"puzzle.page.resources":"리소스 설정",
|
||||
"puzzle.page.performance":"성능 설정",
|
||||
"puzzle.page.misc":"기타 설정",
|
||||
"puzzle.option.check_for_updates":"업데이트 확인",
|
||||
"puzzle.option.show_version_info":"Puzzle 버전 정보 보기",
|
||||
"puzzle.option.resourcepack_splash_screen":"스플래시 화면에서 리소스팩 사용",
|
||||
"puzzle.option.better_splash_screen_blend":"향상된 스플래시 화면 로고 블렌딩",
|
||||
"puzzle.option.emissive_textures":"방사성 텍스쳐",
|
||||
"puzzle.option.unlimited_model_rotations":"모델 회전 제한없음",
|
||||
"puzzle.option.bigger_custom_models":"향상된 커스텀 모델",
|
||||
"puzzle.option.render_layer_overrides":"렌더링 레이어 재정의",
|
||||
"puzzle.midnightconfig.title":"Puzzle 고급 환경설정"
|
||||
}
|
||||
@@ -8,10 +8,10 @@
|
||||
"puzzle.option.check_for_updates":"Проверять обновления",
|
||||
"puzzle.option.show_version_info":"Показывать информацию о версии",
|
||||
"puzzle.option.resourcepack_splash_screen":"Пользовательский экран загрузки",
|
||||
"puzzle.option.disable_splash_screen_blend":"Отключить смешивание логотипа",
|
||||
"puzzle.option.better_splash_screen_blend":"Улучшенное смешивание логотипа",
|
||||
"puzzle.option.emissive_textures":"Светящиеся текстуры",
|
||||
"puzzle.option.unlimited_model_rotations":"Неограниченные повороты моделей",
|
||||
"puzzle.option.bigger_custom_models":"Увеличенный размер моделей",
|
||||
"puzzle.option.render_layer_overrides":"Переопределение слоёв рендеринга",
|
||||
"puzzle.option.render_layer_overrides":"Пользовательские слои отрисовки",
|
||||
"puzzle.midnightconfig.title":"Расширенные настройки Puzzle"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user