From b3fbe9a32cd49e4584c7d6d56a291461c1cab591 Mon Sep 17 00:00:00 2001 From: ErrorCraft Date: Fri, 17 Jul 2026 03:31:35 +0200 Subject: [PATCH 1/2] Port to 26.3 snapshot 4 --- gradle.properties | 4 +- .../mixin/minecraft/nbt/NbtOpsExtender.java | 8 +-- .../resources/HolderSetCodecExtender.java | 53 +++++++------------ .../resources/IdentifierExtender.java | 10 ++-- .../resources/RegistryFileCodecExtender.java | 8 +-- .../resources/RegistryFixedCodecExtender.java | 6 +-- .../minecraft/util/ExtraCodecsExtender.java | 4 +- .../mojang/serialization/JavaOpsExtender.java | 10 ++-- .../mojang/serialization/JsonOpsExtender.java | 12 ++--- .../codecs/BaseMapCodecExtender.java | 8 +-- .../codecs/DispatchedMapCodecExtender.java | 6 +-- .../codecs/FieldDecoderExtender.java | 2 +- .../codecs/KeyDispatchCodecExtender.java | 2 +- .../codecs/ListCodecExtender.java | 4 +- src/main/resources/fabric.mod.json | 2 +- 15 files changed, 63 insertions(+), 76 deletions(-) diff --git a/gradle.properties b/gradle.properties index 03fe541..5272489 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,8 +4,8 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=26.1-snapshot-1 -loader_version=0.18.4 +minecraft_version=26.3-snapshot-4 +loader_version=0.19.3 # Mod Properties mod_version=1.2.0+26.1 diff --git a/src/main/java/net/errorcraft/codecium/mixin/minecraft/nbt/NbtOpsExtender.java b/src/main/java/net/errorcraft/codecium/mixin/minecraft/nbt/NbtOpsExtender.java index 4774b23..519fabd 100644 --- a/src/main/java/net/errorcraft/codecium/mixin/minecraft/nbt/NbtOpsExtender.java +++ b/src/main/java/net/errorcraft/codecium/mixin/minecraft/nbt/NbtOpsExtender.java @@ -23,7 +23,7 @@ public class NbtOpsExtender { target = "Ljava/util/Optional;orElseGet(Ljava/util/function/Supplier;)Ljava/lang/Object;" ) ) - private Supplier> notANumberUseBetterErrorMessage(Supplier> supplier, @Local(argsOnly = true) final Tag input) { + private Supplier> notANumberUseBetterErrorMessage(Supplier> supplier, @Local(argsOnly = true, name = "input") final Tag input) { return () -> DataResult.error(() -> "Element is not a number: " + input); } @@ -34,7 +34,7 @@ private Supplier> notANumberUseBetterErrorMessage(Supplier notAStringUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) final Tag input) { + private Supplier notAStringUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "input") final Tag input) { return () -> "Element is not a string: " + input; } @@ -45,7 +45,7 @@ private Supplier notAStringUseBetterErrorMessage(Supplier messag target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" ) ) - private Supplier notAMapUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) final Tag input) { + private Supplier notAMapUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "input") final Tag input) { return () -> "Element is not a map: " + input; } @@ -56,7 +56,7 @@ private Supplier notAMapUseBetterErrorMessage(Supplier message, target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" ) ) - private Supplier notAListUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) final Tag input) { + private Supplier notAListUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "input") final Tag input) { return () -> "Element is not a list: " + input; } diff --git a/src/main/java/net/errorcraft/codecium/mixin/minecraft/resources/HolderSetCodecExtender.java b/src/main/java/net/errorcraft/codecium/mixin/minecraft/resources/HolderSetCodecExtender.java index 861796a..7ee5aed 100644 --- a/src/main/java/net/errorcraft/codecium/mixin/minecraft/resources/HolderSetCodecExtender.java +++ b/src/main/java/net/errorcraft/codecium/mixin/minecraft/resources/HolderSetCodecExtender.java @@ -1,10 +1,6 @@ package net.errorcraft.codecium.mixin.minecraft.resources; import com.llamalad7.mixinextras.sugar.Local; -import com.mojang.datafixers.util.Pair; -import com.mojang.serialization.DataResult; -import com.mojang.serialization.DynamicOps; -import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; import net.minecraft.core.Registry; import net.minecraft.resources.HolderSetCodec; @@ -13,11 +9,8 @@ import org.spongepowered.asm.mixin.Final; 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.ModifyArg; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.util.function.Supplier; @@ -27,55 +20,49 @@ public class HolderSetCodecExtender { @Final private ResourceKey> registryKey; - @Unique - private static ResourceKey> tempRegistryKey; - @ModifyArg( - method = "lambda$lookupTag$0", + method = "lambda$decode$1", at = @At( value = "INVOKE", target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" ) ) - private static Supplier unknownRegistryTagUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) TagKey tag) { - return () -> "Cannot get a registry tag with id " + tag.location(); + private Supplier decodeInaccessibleRegistryUseBetterErrorMessage(Supplier message) { + return () -> "Registry " + this.registryKey.identifier() + " is inaccessible"; } @ModifyArg( - method = "encode(Lnet/minecraft/core/HolderSet;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)Lcom/mojang/serialization/DataResult;", + method = "lambda$lookupTag$0", at = @At( value = "INVOKE", target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" ) ) - private Supplier invalidOwnerUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) HolderSet holderSet) { - return () -> "Registry tag " + holderSet.unwrapKey().orElseThrow().location() + " is not part of the current registry set"; - } - - @Inject( - method = "decodeWithoutRegistry", - at = @At("HEAD") - ) - private void storeTemporaryRegistryKey(DynamicOps ops, T input, CallbackInfoReturnable, T>>> info) { - HolderSetCodecExtender.tempRegistryKey = this.registryKey; + private static Supplier unknownRegistryTagUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "key") TagKey key) { + return () -> "Cannot get a registry tag with id " + key.location(); } @ModifyArg( - method = "lambda$decodeWithoutRegistry$0", + method = "encode(Lnet/minecraft/core/HolderSet;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)Lcom/mojang/serialization/DataResult;", at = @At( value = "INVOKE", - target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" + target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;", + ordinal = 0 ) ) - private static Supplier inaccessibleRegistryUseBetterErrorMessage(Supplier message, @Local(name = "holder") Holder holder) { - return () -> "Registry " + HolderSetCodecExtender.tempRegistryKey.identifier() + " is inaccessible for " + holder.unwrapKey().orElseThrow(); + private Supplier invalidOwnerUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "input") HolderSet input) { + return () -> "Registry tag " + input.unwrapKey().orElseThrow().location() + " is not part of the current registry set"; } - @Inject( - method = "decodeWithoutRegistry", - at = @At("TAIL") + @ModifyArg( + method = "encode(Lnet/minecraft/core/HolderSet;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)Lcom/mojang/serialization/DataResult;", + at = @At( + value = "INVOKE", + target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;", + ordinal = 1 + ) ) - private void removeTemporaryRegistryKey(DynamicOps ops, T input, CallbackInfoReturnable, T>>> info) { - HolderSetCodecExtender.tempRegistryKey = null; + private Supplier encodeInaccessibleRegistryUseBetterErrorMessage(Supplier message) { + return () -> "Registry " + this.registryKey.identifier() + " is inaccessible"; } } diff --git a/src/main/java/net/errorcraft/codecium/mixin/minecraft/resources/IdentifierExtender.java b/src/main/java/net/errorcraft/codecium/mixin/minecraft/resources/IdentifierExtender.java index 3d04a08..cc6a383 100644 --- a/src/main/java/net/errorcraft/codecium/mixin/minecraft/resources/IdentifierExtender.java +++ b/src/main/java/net/errorcraft/codecium/mixin/minecraft/resources/IdentifierExtender.java @@ -20,12 +20,12 @@ public abstract class IdentifierExtender { public static char NAMESPACE_SEPARATOR; @Shadow - private static boolean validNamespaceChar(char character) { + private static boolean validNamespaceChar(char c) { return false; } @Shadow - public static boolean validPathChar(char character) { + public static boolean validPathChar(char c) { return false; } @@ -36,8 +36,8 @@ public static boolean validPathChar(char character) { target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" ) ) - private static Supplier identifierExceptionUseBetterMessage(Supplier message, @Local(argsOnly = true) String id, @Local(name = "e") IdentifierException exception) { - return () -> ((IdentifierExceptionAccess) exception).codecium$messageWithoutId() + ": " + id; + private static Supplier identifierExceptionUseBetterMessage(Supplier message, @Local(argsOnly = true, name = "input") String input, @Local(name = "e") IdentifierException e) { + return () -> ((IdentifierExceptionAccess) e).codecium$messageWithoutId() + ": " + input; } @Redirect( @@ -47,7 +47,7 @@ private static Supplier identifierExceptionUseBetterMessage(Supplier { target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" ) ) - private Supplier invalidOwnerUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) Holder registryEntry) { - return () -> "Holder " + registryEntry.unwrapKey().orElseThrow().identifier() + " is not part of the current registry set"; + private Supplier invalidOwnerUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "input") Holder input) { + return () -> "Holder " + input.unwrapKey().orElseThrow().identifier() + " is not part of the current registry set"; } @ModifyArg( @@ -61,7 +61,7 @@ private Supplier inlinedHoldersDisallowedUseBetterErrorMessage(Supplier< target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" ) ) - private static Supplier unknownHolderUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) ResourceKey key) { - return () -> "Cannot get a holder with id " + key.identifier(); + private static Supplier unknownHolderUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "elementKey") ResourceKey elementKey) { + return () -> "Cannot get a holder with id " + elementKey.identifier(); } } diff --git a/src/main/java/net/errorcraft/codecium/mixin/minecraft/resources/RegistryFixedCodecExtender.java b/src/main/java/net/errorcraft/codecium/mixin/minecraft/resources/RegistryFixedCodecExtender.java index c888167..9e0d1c2 100644 --- a/src/main/java/net/errorcraft/codecium/mixin/minecraft/resources/RegistryFixedCodecExtender.java +++ b/src/main/java/net/errorcraft/codecium/mixin/minecraft/resources/RegistryFixedCodecExtender.java @@ -28,8 +28,8 @@ public class RegistryFixedCodecExtender { ordinal = 0 ) ) - private Supplier invalidOwnerUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) Holder registryEntry) { - return () -> "Holder " + registryEntry.unwrapKey().orElseThrow().identifier() + " is not part of the current registry set"; + private Supplier invalidOwnerUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "input") Holder input) { + return () -> "Holder " + input.unwrapKey().orElseThrow().identifier() + " is not part of the current registry set"; } @ModifyArg( @@ -73,7 +73,7 @@ private Supplier decodeInaccessibleRegistryUseBetterErrorMessage(Supplie target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" ) ) - private static Supplier unknownHolderUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) Identifier id) { + private static Supplier unknownHolderUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "id") Identifier id) { return () -> "Cannot get a holder with id " + id; } } diff --git a/src/main/java/net/errorcraft/codecium/mixin/minecraft/util/ExtraCodecsExtender.java b/src/main/java/net/errorcraft/codecium/mixin/minecraft/util/ExtraCodecsExtender.java index 9c05f1e..c964dc8 100644 --- a/src/main/java/net/errorcraft/codecium/mixin/minecraft/util/ExtraCodecsExtender.java +++ b/src/main/java/net/errorcraft/codecium/mixin/minecraft/util/ExtraCodecsExtender.java @@ -20,8 +20,8 @@ public class ExtraCodecsExtender { target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" ) ) - private static Supplier unsignedByteTooLarge(Supplier message, @Local(argsOnly = true) final Integer value) { - return () -> "Unsigned byte must be at most 255: " + value; + private static Supplier unsignedByteTooLarge(Supplier message, @Local(argsOnly = true, name = "integer") final Integer integer) { + return () -> "Unsigned byte must be at most 255: " + integer; } @ModifyArg( diff --git a/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/JavaOpsExtender.java b/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/JavaOpsExtender.java index b9f2bf3..b2fee24 100644 --- a/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/JavaOpsExtender.java +++ b/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/JavaOpsExtender.java @@ -21,7 +21,7 @@ public class JavaOpsExtender { target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" ) ) - private Supplier notANumberUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) final Object input) { + private Supplier notANumberUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "input") final Object input) { return () -> "Element is not a number: " + input; } @@ -32,7 +32,7 @@ private Supplier notANumberUseBetterErrorMessage(Supplier messag target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" ) ) - private Supplier notABooleanUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) final Object input) { + private Supplier notABooleanUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "input") final Object input) { return () -> "Element is not a boolean: " + input; } @@ -43,7 +43,7 @@ private Supplier notABooleanUseBetterErrorMessage(Supplier messa target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" ) ) - private Supplier notAStringUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) final Object input) { + private Supplier notAStringUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "input") final Object input) { return () -> "Element is not a string: " + input; } @@ -54,7 +54,7 @@ private Supplier notAStringUseBetterErrorMessage(Supplier messag target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" ) ) - private Supplier notAMapUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, ordinal = 0) final Object input) { + private Supplier notAMapUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "input") final Object input) { return () -> "Element is not a map: " + input; } @@ -65,7 +65,7 @@ private Supplier notAMapUseBetterErrorMessage(Supplier message, target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" ) ) - private Supplier notAListUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, ordinal = 0) final Object input) { + private Supplier notAListUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "input") final Object input) { return () -> "Element is not a list: " + input; } diff --git a/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/JsonOpsExtender.java b/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/JsonOpsExtender.java index 087a181..3d5033b 100644 --- a/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/JsonOpsExtender.java +++ b/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/JsonOpsExtender.java @@ -24,7 +24,7 @@ public class JsonOpsExtender { ordinal = 0 ) ) - private Supplier notANumberWithExceptionUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) final JsonElement input, @Local final NumberFormatException e) { + private Supplier notANumberWithExceptionUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "input") final JsonElement input, @Local(name = "e") final NumberFormatException e) { return () -> ExceptionUtil.errorMessage(e, input); } @@ -36,7 +36,7 @@ private Supplier notANumberWithExceptionUseBetterErrorMessage(Supplier notANumberUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) final JsonElement input) { + private Supplier notANumberUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "input") final JsonElement input) { return () -> "Element is not a number: " + input; } @@ -47,7 +47,7 @@ private Supplier notANumberUseBetterErrorMessage(Supplier messag target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" ) ) - private Supplier notABooleanUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) final JsonElement input) { + private Supplier notABooleanUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "input") final JsonElement input) { return () -> "Element is not a boolean: " + input; } @@ -58,7 +58,7 @@ private Supplier notABooleanUseBetterErrorMessage(Supplier messa target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" ) ) - private Supplier notAStringUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) final JsonElement input) { + private Supplier notAStringUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "input") final JsonElement input) { return () -> "Element is not a string: " + input; } @@ -69,7 +69,7 @@ private Supplier notAStringUseBetterErrorMessage(Supplier messag target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" ) ) - private Supplier notAMapUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) final JsonElement input) { + private Supplier notAMapUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "input") final JsonElement input) { return () -> "Element is not a map: " + input; } @@ -80,7 +80,7 @@ private Supplier notAMapUseBetterErrorMessage(Supplier message, target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" ) ) - private Supplier notAListUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) final JsonElement input) { + private Supplier notAListUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "input") final JsonElement input) { return () -> "Element is not a list: " + input; } diff --git a/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/codecs/BaseMapCodecExtender.java b/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/codecs/BaseMapCodecExtender.java index 2c92821..edb6433 100644 --- a/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/codecs/BaseMapCodecExtender.java +++ b/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/codecs/BaseMapCodecExtender.java @@ -31,7 +31,7 @@ public interface BaseMapCodecExtender { ) ) @SuppressWarnings({ "OptionalUsedAsFieldOrParameterType", "OptionalGetWithoutIsPresent" }) - private Supplier duplicateFieldUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) final DynamicOps ops, @Local(argsOnly = true) final Pair pair, @Local final Optional> entry) { + private Supplier duplicateFieldUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "ops") final DynamicOps ops, @Local(argsOnly = true, name = "pair") final Pair pair, @Local(name = "entry") final Optional> entry) { return () -> "Duplicate field " + this.keyCodec().encodeStart(ops, entry.get().getFirst()).getOrThrow() + ": " + pair.getFirst(); } @@ -43,7 +43,7 @@ private Supplier duplicateFieldUseBetterErrorMessage(Supplier DataResult addKeyToKeyErrorMessage(Codec instance, final DynamicOps dynamicOps, Object o, Operation> original, @Local(argsOnly = true) final Pair pair) { + private DataResult addKeyToKeyErrorMessage(Codec instance, final DynamicOps dynamicOps, Object o, Operation> original, @Local(argsOnly = true, name = "pair") final Pair pair) { return original.call(instance, dynamicOps, o) .mapError(message -> "For key " + pair.getFirst() + ": " + message); } @@ -56,7 +56,7 @@ private DataResult addKeyToKeyErrorMessage(Codec instance, final Dynam ordinal = 0 ) ) - private DataResult addKeyToValueErrorMessage(DataResult second, @Local(argsOnly = true) final Pair pair) { + private DataResult addKeyToValueErrorMessage(DataResult second, @Local(argsOnly = true, name = "pair") final Pair pair) { return second.mapError(message -> "For value " + pair.getFirst() + ": " + message); } @@ -67,7 +67,7 @@ private DataResult addKeyToValueErrorMessage(DataResult second, @Local target = "Lcom/mojang/serialization/DataResult;mapError(Ljava/util/function/UnaryOperator;)Lcom/mojang/serialization/DataResult;" ) ) - private UnaryOperator mapErrorsUseBetterErrorMessage(UnaryOperator function, @Local final T errors) { + private UnaryOperator mapErrorsUseBetterErrorMessage(UnaryOperator function) { return message -> "Map has errors:\n" + StringUtil.indent(message); } } diff --git a/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/codecs/DispatchedMapCodecExtender.java b/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/codecs/DispatchedMapCodecExtender.java index 00807af..68803fb 100644 --- a/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/codecs/DispatchedMapCodecExtender.java +++ b/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/codecs/DispatchedMapCodecExtender.java @@ -33,15 +33,15 @@ public class DispatchedMapCodecExtender { ) ) @SuppressWarnings({ "OptionalUsedAsFieldOrParameterType", "OptionalGetWithoutIsPresent" }) - private Supplier duplicateFieldUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) final DynamicOps ops, @Local(argsOnly = true) final Pair pair, @Local final Optional> entry) { - return () -> "Duplicate field " + this.keyCodec.encodeStart(ops, entry.get().getFirst()).getOrThrow() + ": " + pair.getFirst(); + private Supplier duplicateFieldUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "ops") final DynamicOps ops, @Local(argsOnly = true, name = "input") final Pair input, @Local(name = "entry") final Optional> entry) { + return () -> "Duplicate field " + this.keyCodec.encodeStart(ops, entry.get().getFirst()).getOrThrow() + ": " + input.getFirst(); } @ModifyReturnValue( method = "parseEntry", at = @At("TAIL") ) - private DataResult duplicateFieldUseBetterErrorMessage(DataResult original, @Local(argsOnly = true) final Pair input) { + private DataResult duplicateFieldUseBetterErrorMessage(DataResult original, @Local(argsOnly = true, name = "input") final Pair input) { return original.mapError(message -> "For field " + input.getFirst() + ": " + message); } diff --git a/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/codecs/FieldDecoderExtender.java b/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/codecs/FieldDecoderExtender.java index ad4545b..5fa3dfc 100644 --- a/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/codecs/FieldDecoderExtender.java +++ b/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/codecs/FieldDecoderExtender.java @@ -24,7 +24,7 @@ public class FieldDecoderExtender { target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" ) ) - private Supplier useBetterErrorMessage(Supplier message, @Local(argsOnly = true) final MapLike input) { + private Supplier useBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "input") final MapLike input) { return () -> "Key '" + this.name + "' must be present in map: " + input; } } diff --git a/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/codecs/KeyDispatchCodecExtender.java b/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/codecs/KeyDispatchCodecExtender.java index 2d77028..b3b2b28 100644 --- a/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/codecs/KeyDispatchCodecExtender.java +++ b/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/codecs/KeyDispatchCodecExtender.java @@ -24,7 +24,7 @@ public class KeyDispatchCodecExtender { target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" ) ) - private static Supplier noValueKeyUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) final MapLike input) { + private static Supplier noValueKeyUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "input") final MapLike input) { return () -> "Key '" + COMPRESSED_VALUE_KEY + "' must be present in map: " + input; } } diff --git a/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/codecs/ListCodecExtender.java b/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/codecs/ListCodecExtender.java index 18c8793..84cee06 100644 --- a/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/codecs/ListCodecExtender.java +++ b/src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/codecs/ListCodecExtender.java @@ -40,7 +40,7 @@ public class ListCodecExtender implements ListCodecAccess { target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" ) ) - private Supplier tooShortUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) final int size) { + private Supplier tooShortUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "size") final int size) { return () -> "List must have at least " + this.minSize + " " + EnglishUtil.pluralize(this.minSize, "value") + ", but got " + size; } @@ -51,7 +51,7 @@ private Supplier tooShortUseBetterErrorMessage(Supplier message, target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;" ) ) - private Supplier tooLongUseBetterErrorMessage(Supplier message, @Local(argsOnly = true) final int size) { + private Supplier tooLongUseBetterErrorMessage(Supplier message, @Local(argsOnly = true, name = "size") final int size) { return () -> "List must have at most " + this.maxSize + " " + EnglishUtil.pluralize(this.maxSize, "value") + ", but got " + size; } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index fbc3828..04488c1 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -27,7 +27,7 @@ ], "depends": { "fabricloader": ">=0.18.4", - "minecraft": ">=26.1-", + "minecraft": ">=26.3-alpha.4", "java": ">=25" }, "suggests": { From 7bf82ec6dddb44b4a92f4988d0ef68f01721ad87 Mon Sep 17 00:00:00 2001 From: ErrorCraft Date: Fri, 17 Jul 2026 03:43:31 +0200 Subject: [PATCH 2/2] Update build workflow to use Java 25 --- .github/workflows/build.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a4e3e0b..0a4bd5a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,16 +12,16 @@ jobs: matrix: # Use these Java versions java: [ - 21, # Current Java LTS + 25, # Current Java LTS ] - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: validate gradle wrapper - uses: gradle/actions/wrapper-validation@v4 + uses: gradle/actions/wrapper-validation@v5 - name: setup jdk ${{ matrix.java }} - uses: actions/setup-java@v4 + uses: actions/setup-java@v5 with: java-version: ${{ matrix.java }} distribution: 'microsoft' @@ -30,8 +30,8 @@ jobs: - name: build run: ./gradlew build - name: capture build artifacts - if: ${{ matrix.java == '21' }} # Only upload artifacts built from latest java - uses: actions/upload-artifact@v4 + if: ${{ matrix.java == '25' }} # Only upload artifacts built from latest java + uses: actions/upload-artifact@v7 with: name: Artifacts path: build/libs/ \ No newline at end of file