diff options
| author | Aaron <51387595+AzureAaron@users.noreply.github.com> | 2025-04-25 16:25:27 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-25 16:25:27 -0400 |
| commit | bf18fb9b0054177b3dee145d681c8ff1dd60418e (patch) | |
| tree | fe7bf2a801644045d75982c714d28964f0a6bad7 /src | |
| parent | 723cfecdbed263d3acd834404033e6c7df28c1e0 (diff) | |
| download | Skyblocker-bf18fb9b0054177b3dee145d681c8ff1dd60418e.tar.gz Skyblocker-bf18fb9b0054177b3dee145d681c8ff1dd60418e.tar.bz2 Skyblocker-bf18fb9b0054177b3dee145d681c8ff1dd60418e.zip | |
1.21.5 (#1256)
* 1.21.5
* Test fixes and clean up
* Update test screenshot
* Record patterns
* Performance optimization
* Reset ordered waypoint index on world change (and stop serializing it)
* Waypoints clean up and fixes (#1257)
* Small waypoints clean up
* Fix waypoints test codec field order
* Safe config updates
Rather than updating the values directly and then calling save, the mod
will now handle this behaviour itself to ensure update
consistency/visibility with the upcoming thread split. Most usages of
the old method were converted but there are some left.
---------
Co-authored-by: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com>
Diffstat (limited to 'src')
93 files changed, 708 insertions, 431 deletions
diff --git a/src/gametest/resources/templates/skyblocker_render.png b/src/gametest/resources/templates/skyblocker_render.png Binary files differindex d603a577..67dbacd7 100644 --- a/src/gametest/resources/templates/skyblocker_render.png +++ b/src/gametest/resources/templates/skyblocker_render.png diff --git a/src/main/java/de/hysky/skyblocker/UpdateNotifications.java b/src/main/java/de/hysky/skyblocker/UpdateNotifications.java index 00ae9ac0..4f9deef0 100644 --- a/src/main/java/de/hysky/skyblocker/UpdateNotifications.java +++ b/src/main/java/de/hysky/skyblocker/UpdateNotifications.java @@ -2,6 +2,7 @@ package de.hysky.skyblocker; import java.io.BufferedReader; import java.io.BufferedWriter; +import java.net.URI; import java.nio.file.Files; import java.nio.file.NoSuchFileException; import java.nio.file.Path; @@ -104,7 +105,7 @@ public class UpdateNotifications { Text versionText = Text.literal(newVersion.name()).styled(style -> style .withFormatting(Formatting.GRAY) .withUnderline(true) - .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, downloadLink))); + .withClickEvent(new ClickEvent.OpenUrl(URI.create(downloadLink)))); CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("skyblocker.updateNotifications.newUpdateMessage", versionText)), false); SystemToast.add(CLIENT.getToastManager(), TOAST_TYPE, Text.translatable("skyblocker.updateNotifications.newUpdateToast.title"), Text.stringifiedTranslatable("skyblocker.updateNotifications.newUpdateToast.description", newVersion.version())); diff --git a/src/main/java/de/hysky/skyblocker/compatibility/MixinPlugin.java b/src/main/java/de/hysky/skyblocker/compatibility/MixinPlugin.java index 7820dfa4..2af8860e 100644 --- a/src/main/java/de/hysky/skyblocker/compatibility/MixinPlugin.java +++ b/src/main/java/de/hysky/skyblocker/compatibility/MixinPlugin.java @@ -1,6 +1,8 @@ package de.hysky.skyblocker.compatibility; import net.fabricmc.loader.api.FabricLoader; + +import org.apache.commons.lang3.SystemUtils; import org.objectweb.asm.tree.ClassNode; import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; import org.spongepowered.asm.mixin.extensibility.IMixinInfo; @@ -23,8 +25,12 @@ public class MixinPlugin implements IMixinConfigPlugin { @Override public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { - //OptiFabric Compatibility - return !mixinClassName.endsWith("WorldRendererMixin") || !OPTIFABRIC_LOADED; + return switch (mixinClassName) { + case String s when s.endsWith("WorldRendererMixin") -> !OPTIFABRIC_LOADED; + case String s when s.endsWith("GlResourceManagerMixin") -> SystemUtils.IS_OS_MAC && "aarch64".equalsIgnoreCase(SystemUtils.OS_ARCH); + + default -> true; + }; } @Override diff --git a/src/main/java/de/hysky/skyblocker/config/CodecTypeAdapter.java b/src/main/java/de/hysky/skyblocker/config/CodecTypeAdapter.java new file mode 100644 index 00000000..27544703 --- /dev/null +++ b/src/main/java/de/hysky/skyblocker/config/CodecTypeAdapter.java @@ -0,0 +1,28 @@ +package de.hysky.skyblocker.config; + +import java.lang.reflect.Type; + +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonParseException; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.mojang.serialization.Codec; +import com.mojang.serialization.JsonOps; + +/** + * Creates a GSON type adapter from a {@link Codec}. + */ +public record CodecTypeAdapter<T>(Codec<T> codec) implements JsonSerializer<T>, JsonDeserializer<T> { + + @Override + public T deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { + return codec.parse(JsonOps.INSTANCE, json).getOrThrow(JsonParseException::new); + } + + @Override + public JsonElement serialize(T src, Type typeOfSrc, JsonSerializationContext context) { + return codec.encodeStart(JsonOps.INSTANCE, src).getOrThrow(); + } +} diff --git a/src/main/java/de/hysky/skyblocker/config/HudConfigScreen.java b/src/main/java/de/hysky/skyblocker/config/HudConfigScreen.java index 06bec737..82ac889e 100644 --- a/src/main/java/de/hysky/skyblocker/config/HudConfigScreen.java +++ b/src/main/java/de/hysky/skyblocker/config/HudConfigScreen.java @@ -133,10 +133,7 @@ public abstract class HudConfigScreen extends Screen { @Override public final void close() { - SkyblockerConfig skyblockerConfig = SkyblockerConfigManager.get(); - savePos(skyblockerConfig, widgets); - SkyblockerConfigManager.save(); - + SkyblockerConfigMan |
