-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix snowy biome colours + warning screen.
- Loading branch information
Showing
7 changed files
with
93 additions
and
10 deletions.
There are no files selected for viewing
12 changes: 6 additions & 6 deletions
12
src/main/generated/.cache/479d532b8ab79818d0335395e7c3c8b4e15a0c44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
4 changes: 2 additions & 2 deletions
4
src/main/generated/assets/c/fog_definitions/tag/biome/is_snowy.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/main/java/dev/imb11/fog/client/util/UpdateWarningHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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."); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/dev/imb11/fog/mixin/client/ui/TitleScreenMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters