diff --git a/src/main/generated/.cache/479d532b8ab79818d0335395e7c3c8b4e15a0c44 b/src/main/generated/.cache/479d532b8ab79818d0335395e7c3c8b4e15a0c44 index 7cb9ad5..48ec183 100644 --- a/src/main/generated/.cache/479d532b8ab79818d0335395e7c3c8b4e15a0c44 +++ b/src/main/generated/.cache/479d532b8ab79818d0335395e7c3c8b4e15a0c44 @@ -1,15 +1,15 @@ -// 1.21.1 2024-08-30T19:57:10.8858252 Fog/Custom Fog Definition:fog +// 1.21.1 2024-08-31T10:48:07.9332249 Fog/Custom Fog Definition:fog ed7a26be0cdc64db4e2714898fec43817761c00b assets\minecraft\fog_definitions\biome\crimson_forest.json -61268868389f80ddd2fc175dab578a5a6d3775dd assets\c\fog_definitions\tag\biome\is_aquatic_icy.json -bdf7dff67ada32610d3c8970f29d8c74d654ca55 assets\c\fog_definitions\tag\biome\is_beach.json -efa18c3764d4d5d57a4ca2f3dabd69d188148a19 assets\minecraft\fog_definitions\biome\soul_sand_valley.json -ff9939863833df7f1cc8b94bec65cb20c1272cce assets\c\fog_definitions\tag\biome\is_snowy.json 081f23017dccbbbbf86d0fed5183724dd3b2fae7 assets\minecraft\fog_definitions\biome\basalt_deltas.json 0aadd5cec8445c0814015d19f23cfb515e4fff62 assets\c\fog_definitions\tag\biome\is_badlands.json -d18991fdc8b5c612a3ae1b45144585860b1bf064 assets\minecraft\fog_definitions\biome\nether_wastes.json 6ab53206f31ea26518ebf301389f655c2846e67e assets\c\fog_definitions\tag\biome\is_desert.json +d18991fdc8b5c612a3ae1b45144585860b1bf064 assets\minecraft\fog_definitions\biome\nether_wastes.json 024071636ecdb7f6288625a11a90b2d75d65c917 assets\minecraft\fog_definitions\biome\sparse_jungle.json +61268868389f80ddd2fc175dab578a5a6d3775dd assets\c\fog_definitions\tag\biome\is_aquatic_icy.json +bdf7dff67ada32610d3c8970f29d8c74d654ca55 assets\c\fog_definitions\tag\biome\is_beach.json +efa18c3764d4d5d57a4ca2f3dabd69d188148a19 assets\minecraft\fog_definitions\biome\soul_sand_valley.json 4a095b16c1146432aee0cd907ceb87d33c031738 assets\c\fog_definitions\tag\biome\is_end.json 5e48288dad15e0c0bfd3db7ada891bc50cdbc5a2 assets\c\fog_definitions\tag\biome\is_jungle.json 450e4e8e01a0af4128b371ad342d4a0d7bd9e560 assets\c\fog_definitions\tag\biome\is_swamp.json e21ca1bacda76f8e67c3a79262c54bb45b0f70ce assets\minecraft\fog_definitions\biome\warped_forest.json +66dbd1cc3283d1f6a3f9f8c789e67baabc193059 assets\c\fog_definitions\tag\biome\is_snowy.json diff --git a/src/main/generated/assets/c/fog_definitions/tag/biome/is_snowy.json b/src/main/generated/assets/c/fog_definitions/tag/biome/is_snowy.json index a5a6fd9..8ff7761 100644 --- a/src/main/generated/assets/c/fog_definitions/tag/biome/is_snowy.json +++ b/src/main/generated/assets/c/fog_definitions/tag/biome/is_snowy.json @@ -1,7 +1,7 @@ { "colors": { - "day": "#F4F9EF", - "night": "#F4F9EF" + "day": "#DFEBF4", + "night": "#687782" }, "end_multiplier": 1.0, "start_multiplier": 1.0 diff --git a/src/main/java/dev/imb11/fog/client/util/UpdateWarningHelper.java b/src/main/java/dev/imb11/fog/client/util/UpdateWarningHelper.java new file mode 100644 index 0000000..e5452b8 --- /dev/null +++ b/src/main/java/dev/imb11/fog/client/util/UpdateWarningHelper.java @@ -0,0 +1,52 @@ +package dev.imb11.fog.client.util; + +import dev.imb11.fog.client.FogClient; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.ConfirmScreen; +import net.minecraft.client.gui.screen.TitleScreen; +import net.minecraft.screen.ScreenTexts; +import net.minecraft.text.Text; + +import java.nio.file.Files; + +public class UpdateWarningHelper { + // TODO: Bump this every time you modify something within the datagen classes. + public static int getDatagenVersion() { + return 1; + } + + public static void checkVersion() { + var datagenVersionPath = FogClient.getConfigFolder().resolve("datagen.version"); + + boolean shouldWarn = true; + // Check if datagenVersionPath content is < datagenVersion + if (datagenVersionPath.toFile().exists()) { + try { + var version = Integer.parseInt(Files.readString(datagenVersionPath)); + if (version >= getDatagenVersion()) { + shouldWarn = false; + } + } catch (Exception e) { + // Ignore + } + } + + if (shouldWarn) { + MinecraftClient client = MinecraftClient.getInstance(); + + client.setScreen(new ConfirmScreen( + confirmed -> { + try { + Files.writeString(datagenVersionPath, Integer.toString(getDatagenVersion())); + } catch (Exception ignored) {} + client.setScreen(new TitleScreen()); + }, + Text.translatable("fog.datagen_warning.title"), + Text.translatable("fog.datagen_warning.message"), + ScreenTexts.OK, + ScreenTexts.OK + )); + FogClient.LOGGER.info("Datagen warning displayed - you may need to delete the `.minecraft/config/fog/fog_definitions` folder."); + } + } +} diff --git a/src/main/java/dev/imb11/fog/loaders/fabric/datagen/VanillaFogDefinitionProvider.java b/src/main/java/dev/imb11/fog/loaders/fabric/datagen/VanillaFogDefinitionProvider.java index 66e5b32..9863e2b 100644 --- a/src/main/java/dev/imb11/fog/loaders/fabric/datagen/VanillaFogDefinitionProvider.java +++ b/src/main/java/dev/imb11/fog/loaders/fabric/datagen/VanillaFogDefinitionProvider.java @@ -55,7 +55,7 @@ public void acceptBiomeTags(@NotNull BiConsumer, CustomFogDefiniti .colors("#D1C8AB", "#827D6A").build()); provider.accept(ConventionalBiomeTags.IS_SNOWY, CustomFogDefinition.Builder.create() - .colors("#F4F9EF", "#F4F9EF").build()); + .colors("#DFEBF4", "#687782").build()); provider.accept(ConventionalBiomeTags.IS_AQUATIC_ICY, CustomFogDefinition.Builder.create() .colors("#BDDBE1", "#526C72").build()); diff --git a/src/main/java/dev/imb11/fog/mixin/client/ui/TitleScreenMixin.java b/src/main/java/dev/imb11/fog/mixin/client/ui/TitleScreenMixin.java new file mode 100644 index 0000000..f883fbc --- /dev/null +++ b/src/main/java/dev/imb11/fog/mixin/client/ui/TitleScreenMixin.java @@ -0,0 +1,28 @@ +package dev.imb11.fog.mixin.client.ui; + +import dev.imb11.fog.client.util.UpdateWarningHelper; +import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.screen.TitleScreen; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(TitleScreen.class) +public class TitleScreenMixin { + @Shadow + private boolean doBackgroundFade; + + @Unique + private static boolean hasShown = false; + + @Inject(at = @At("HEAD"), method = "render") + public void showAfterLoaded(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { + if (this.doBackgroundFade && !hasShown) { + UpdateWarningHelper.checkVersion(); + hasShown = true; + } + } +} diff --git a/src/main/resources/assets/fog/lang/en_us.json b/src/main/resources/assets/fog/lang/en_us.json index 8f6a312..425ded5 100644 --- a/src/main/resources/assets/fog/lang/en_us.json +++ b/src/main/resources/assets/fog/lang/en_us.json @@ -1,4 +1,6 @@ { + "fog.datagen_warning.title": "§6§l§nWarning!§r", + "fog.datagen_warning.message": "Fog has been updated, changing the default biome fog colors.\nPlease back up your changes to the `.minecraft/config/fog/fog_definitions` folder before deleting it to apply the new changes.\nThis will not be shown again. (Note: Pressing 'OK' will not delete the folder for you.)", "fog.config.category.fog_calculations": "Fog Calculations", "fog.config.option.fog_calculations.warning": "§6§l§nWarning!§r It is not recommended to touch these constants unless you understand what they do, and how they are used.\nConsider leaving them as-is for the best experience.", "fog.config.option.initial_fog_start": "Initial Fog Start", diff --git a/src/main/resources/fog.mixins.json b/src/main/resources/fog.mixins.json index 53dffd9..42aa297 100644 --- a/src/main/resources/fog.mixins.json +++ b/src/main/resources/fog.mixins.json @@ -10,6 +10,7 @@ "mixins": [], "client": [ "client.rendering.BackgroundRendererMixin", - "client.rendering.WorldRendererMixin" + "client.rendering.WorldRendererMixin", + "client.ui.TitleScreenMixin" ] }