Skip to content

Commit b3fbe9a

Browse files
committed
Port to 26.3 snapshot 4
1 parent c1936a4 commit b3fbe9a

15 files changed

Lines changed: 63 additions & 76 deletions

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ org.gradle.parallel=true
44

55
# Fabric Properties
66
# check these on https://fabricmc.net/develop
7-
minecraft_version=26.1-snapshot-1
8-
loader_version=0.18.4
7+
minecraft_version=26.3-snapshot-4
8+
loader_version=0.19.3
99

1010
# Mod Properties
1111
mod_version=1.2.0+26.1

src/main/java/net/errorcraft/codecium/mixin/minecraft/nbt/NbtOpsExtender.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class NbtOpsExtender {
2323
target = "Ljava/util/Optional;orElseGet(Ljava/util/function/Supplier;)Ljava/lang/Object;"
2424
)
2525
)
26-
private Supplier<DataResult<Number>> notANumberUseBetterErrorMessage(Supplier<DataResult<Number>> supplier, @Local(argsOnly = true) final Tag input) {
26+
private Supplier<DataResult<Number>> notANumberUseBetterErrorMessage(Supplier<DataResult<Number>> supplier, @Local(argsOnly = true, name = "input") final Tag input) {
2727
return () -> DataResult.error(() -> "Element is not a number: " + input);
2828
}
2929

@@ -34,7 +34,7 @@ private Supplier<DataResult<Number>> notANumberUseBetterErrorMessage(Supplier<Da
3434
target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;"
3535
)
3636
)
37-
private Supplier<String> notAStringUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true) final Tag input) {
37+
private Supplier<String> notAStringUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true, name = "input") final Tag input) {
3838
return () -> "Element is not a string: " + input;
3939
}
4040

@@ -45,7 +45,7 @@ private Supplier<String> notAStringUseBetterErrorMessage(Supplier<String> messag
4545
target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;"
4646
)
4747
)
48-
private Supplier<String> notAMapUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true) final Tag input) {
48+
private Supplier<String> notAMapUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true, name = "input") final Tag input) {
4949
return () -> "Element is not a map: " + input;
5050
}
5151

@@ -56,7 +56,7 @@ private Supplier<String> notAMapUseBetterErrorMessage(Supplier<String> message,
5656
target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;"
5757
)
5858
)
59-
private Supplier<String> notAListUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true) final Tag input) {
59+
private Supplier<String> notAListUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true, name = "input") final Tag input) {
6060
return () -> "Element is not a list: " + input;
6161
}
6262

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
package net.errorcraft.codecium.mixin.minecraft.resources;
22

33
import com.llamalad7.mixinextras.sugar.Local;
4-
import com.mojang.datafixers.util.Pair;
5-
import com.mojang.serialization.DataResult;
6-
import com.mojang.serialization.DynamicOps;
7-
import net.minecraft.core.Holder;
84
import net.minecraft.core.HolderSet;
95
import net.minecraft.core.Registry;
106
import net.minecraft.resources.HolderSetCodec;
@@ -13,11 +9,8 @@
139
import org.spongepowered.asm.mixin.Final;
1410
import org.spongepowered.asm.mixin.Mixin;
1511
import org.spongepowered.asm.mixin.Shadow;
16-
import org.spongepowered.asm.mixin.Unique;
1712
import org.spongepowered.asm.mixin.injection.At;
18-
import org.spongepowered.asm.mixin.injection.Inject;
1913
import org.spongepowered.asm.mixin.injection.ModifyArg;
20-
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
2114

2215
import java.util.function.Supplier;
2316

@@ -27,55 +20,49 @@ public class HolderSetCodecExtender<E> {
2720
@Final
2821
private ResourceKey<? extends Registry<E>> registryKey;
2922

30-
@Unique
31-
private static ResourceKey<? extends Registry<?>> tempRegistryKey;
32-
3323
@ModifyArg(
34-
method = "lambda$lookupTag$0",
24+
method = "lambda$decode$1",
3525
at = @At(
3626
value = "INVOKE",
3727
target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;"
3828
)
3929
)
40-
private static <E> Supplier<String> unknownRegistryTagUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true) TagKey<E> tag) {
41-
return () -> "Cannot get a registry tag with id " + tag.location();
30+
private Supplier<String> decodeInaccessibleRegistryUseBetterErrorMessage(Supplier<String> message) {
31+
return () -> "Registry " + this.registryKey.identifier() + " is inaccessible";
4232
}
4333

4434
@ModifyArg(
45-
method = "encode(Lnet/minecraft/core/HolderSet;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)Lcom/mojang/serialization/DataResult;",
35+
method = "lambda$lookupTag$0",
4636
at = @At(
4737
value = "INVOKE",
4838
target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;"
4939
)
5040
)
51-
private Supplier<String> invalidOwnerUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true) HolderSet<E> holderSet) {
52-
return () -> "Registry tag " + holderSet.unwrapKey().orElseThrow().location() + " is not part of the current registry set";
53-
}
54-
55-
@Inject(
56-
method = "decodeWithoutRegistry",
57-
at = @At("HEAD")
58-
)
59-
private <T> void storeTemporaryRegistryKey(DynamicOps<T> ops, T input, CallbackInfoReturnable<DataResult<Pair<HolderSet<E>, T>>> info) {
60-
HolderSetCodecExtender.tempRegistryKey = this.registryKey;
41+
private static <E> Supplier<String> unknownRegistryTagUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true, name = "key") TagKey<E> key) {
42+
return () -> "Cannot get a registry tag with id " + key.location();
6143
}
6244

6345
@ModifyArg(
64-
method = "lambda$decodeWithoutRegistry$0",
46+
method = "encode(Lnet/minecraft/core/HolderSet;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)Lcom/mojang/serialization/DataResult;",
6547
at = @At(
6648
value = "INVOKE",
67-
target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;"
49+
target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;",
50+
ordinal = 0
6851
)
6952
)
70-
private static <R> Supplier<String> inaccessibleRegistryUseBetterErrorMessage(Supplier<String> message, @Local(name = "holder") Holder<R> holder) {
71-
return () -> "Registry " + HolderSetCodecExtender.tempRegistryKey.identifier() + " is inaccessible for " + holder.unwrapKey().orElseThrow();
53+
private Supplier<String> invalidOwnerUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true, name = "input") HolderSet<E> input) {
54+
return () -> "Registry tag " + input.unwrapKey().orElseThrow().location() + " is not part of the current registry set";
7255
}
7356

74-
@Inject(
75-
method = "decodeWithoutRegistry",
76-
at = @At("TAIL")
57+
@ModifyArg(
58+
method = "encode(Lnet/minecraft/core/HolderSet;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)Lcom/mojang/serialization/DataResult;",
59+
at = @At(
60+
value = "INVOKE",
61+
target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;",
62+
ordinal = 1
63+
)
7764
)
78-
private <T> void removeTemporaryRegistryKey(DynamicOps<T> ops, T input, CallbackInfoReturnable<DataResult<Pair<HolderSet<E>, T>>> info) {
79-
HolderSetCodecExtender.tempRegistryKey = null;
65+
private Supplier<String> encodeInaccessibleRegistryUseBetterErrorMessage(Supplier<String> message) {
66+
return () -> "Registry " + this.registryKey.identifier() + " is inaccessible";
8067
}
8168
}

src/main/java/net/errorcraft/codecium/mixin/minecraft/resources/IdentifierExtender.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ public abstract class IdentifierExtender {
2020
public static char NAMESPACE_SEPARATOR;
2121

2222
@Shadow
23-
private static boolean validNamespaceChar(char character) {
23+
private static boolean validNamespaceChar(char c) {
2424
return false;
2525
}
2626

2727
@Shadow
28-
public static boolean validPathChar(char character) {
28+
public static boolean validPathChar(char c) {
2929
return false;
3030
}
3131

@@ -36,8 +36,8 @@ public static boolean validPathChar(char character) {
3636
target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;"
3737
)
3838
)
39-
private static Supplier<String> identifierExceptionUseBetterMessage(Supplier<String> message, @Local(argsOnly = true) String id, @Local(name = "e") IdentifierException exception) {
40-
return () -> ((IdentifierExceptionAccess) exception).codecium$messageWithoutId() + ": " + id;
39+
private static Supplier<String> identifierExceptionUseBetterMessage(Supplier<String> message, @Local(argsOnly = true, name = "input") String input, @Local(name = "e") IdentifierException e) {
40+
return () -> ((IdentifierExceptionAccess) e).codecium$messageWithoutId() + ": " + input;
4141
}
4242

4343
@Redirect(
@@ -47,7 +47,7 @@ private static Supplier<String> identifierExceptionUseBetterMessage(Supplier<Str
4747
target = "Lnet/minecraft/resources/Identifier;isValidNamespace(Ljava/lang/String;)Z"
4848
)
4949
)
50-
private static boolean validateNamespaceUseBetterMessage(String namespace, String path) {
50+
private static boolean validateNamespaceUseBetterMessage(String namespace, @Local(argsOnly = true, name = "path") String path) {
5151
for (int i = 0; i < namespace.length(); i++) {
5252
if (!validNamespaceChar(namespace.charAt(i))) {
5353
IdentifierException exception = new IdentifierException("Invalid character '" + namespace.charAt(i) + "' in namespace of resource location");

src/main/java/net/errorcraft/codecium/mixin/minecraft/resources/RegistryFileCodecExtender.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ public class RegistryFileCodecExtender<E> {
2626
target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;"
2727
)
2828
)
29-
private Supplier<String> invalidOwnerUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true) Holder<E> registryEntry) {
30-
return () -> "Holder " + registryEntry.unwrapKey().orElseThrow().identifier() + " is not part of the current registry set";
29+
private Supplier<String> invalidOwnerUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true, name = "input") Holder<E> input) {
30+
return () -> "Holder " + input.unwrapKey().orElseThrow().identifier() + " is not part of the current registry set";
3131
}
3232

3333
@ModifyArg(
@@ -61,7 +61,7 @@ private Supplier<String> inlinedHoldersDisallowedUseBetterErrorMessage(Supplier<
6161
target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;"
6262
)
6363
)
64-
private static <E> Supplier<String> unknownHolderUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true) ResourceKey<E> key) {
65-
return () -> "Cannot get a holder with id " + key.identifier();
64+
private static <E> Supplier<String> unknownHolderUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true, name = "elementKey") ResourceKey<E> elementKey) {
65+
return () -> "Cannot get a holder with id " + elementKey.identifier();
6666
}
6767
}

src/main/java/net/errorcraft/codecium/mixin/minecraft/resources/RegistryFixedCodecExtender.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ public class RegistryFixedCodecExtender<E> {
2828
ordinal = 0
2929
)
3030
)
31-
private Supplier<String> invalidOwnerUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true) Holder<E> registryEntry) {
32-
return () -> "Holder " + registryEntry.unwrapKey().orElseThrow().identifier() + " is not part of the current registry set";
31+
private Supplier<String> invalidOwnerUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true, name = "input") Holder<E> input) {
32+
return () -> "Holder " + input.unwrapKey().orElseThrow().identifier() + " is not part of the current registry set";
3333
}
3434

3535
@ModifyArg(
@@ -73,7 +73,7 @@ private Supplier<String> decodeInaccessibleRegistryUseBetterErrorMessage(Supplie
7373
target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;"
7474
)
7575
)
76-
private static Supplier<String> unknownHolderUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true) Identifier id) {
76+
private static Supplier<String> unknownHolderUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true, name = "id") Identifier id) {
7777
return () -> "Cannot get a holder with id " + id;
7878
}
7979
}

src/main/java/net/errorcraft/codecium/mixin/minecraft/util/ExtraCodecsExtender.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ public class ExtraCodecsExtender {
2020
target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;"
2121
)
2222
)
23-
private static Supplier<String> unsignedByteTooLarge(Supplier<String> message, @Local(argsOnly = true) final Integer value) {
24-
return () -> "Unsigned byte must be at most 255: " + value;
23+
private static Supplier<String> unsignedByteTooLarge(Supplier<String> message, @Local(argsOnly = true, name = "integer") final Integer integer) {
24+
return () -> "Unsigned byte must be at most 255: " + integer;
2525
}
2626

2727
@ModifyArg(

src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/JavaOpsExtender.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class JavaOpsExtender {
2121
target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;"
2222
)
2323
)
24-
private Supplier<String> notANumberUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true) final Object input) {
24+
private Supplier<String> notANumberUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true, name = "input") final Object input) {
2525
return () -> "Element is not a number: " + input;
2626
}
2727

@@ -32,7 +32,7 @@ private Supplier<String> notANumberUseBetterErrorMessage(Supplier<String> messag
3232
target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;"
3333
)
3434
)
35-
private Supplier<String> notABooleanUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true) final Object input) {
35+
private Supplier<String> notABooleanUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true, name = "input") final Object input) {
3636
return () -> "Element is not a boolean: " + input;
3737
}
3838

@@ -43,7 +43,7 @@ private Supplier<String> notABooleanUseBetterErrorMessage(Supplier<String> messa
4343
target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;"
4444
)
4545
)
46-
private Supplier<String> notAStringUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true) final Object input) {
46+
private Supplier<String> notAStringUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true, name = "input") final Object input) {
4747
return () -> "Element is not a string: " + input;
4848
}
4949

@@ -54,7 +54,7 @@ private Supplier<String> notAStringUseBetterErrorMessage(Supplier<String> messag
5454
target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;"
5555
)
5656
)
57-
private Supplier<String> notAMapUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true, ordinal = 0) final Object input) {
57+
private Supplier<String> notAMapUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true, name = "input") final Object input) {
5858
return () -> "Element is not a map: " + input;
5959
}
6060

@@ -65,7 +65,7 @@ private Supplier<String> notAMapUseBetterErrorMessage(Supplier<String> message,
6565
target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;"
6666
)
6767
)
68-
private Supplier<String> notAListUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true, ordinal = 0) final Object input) {
68+
private Supplier<String> notAListUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true, name = "input") final Object input) {
6969
return () -> "Element is not a list: " + input;
7070
}
7171

src/main/java/net/errorcraft/codecium/mixin/mojang/serialization/JsonOpsExtender.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class JsonOpsExtender {
2424
ordinal = 0
2525
)
2626
)
27-
private Supplier<String> notANumberWithExceptionUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true) final JsonElement input, @Local final NumberFormatException e) {
27+
private Supplier<String> notANumberWithExceptionUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true, name = "input") final JsonElement input, @Local(name = "e") final NumberFormatException e) {
2828
return () -> ExceptionUtil.errorMessage(e, input);
2929
}
3030

@@ -36,7 +36,7 @@ private Supplier<String> notANumberWithExceptionUseBetterErrorMessage(Supplier<S
3636
ordinal = 1
3737
)
3838
)
39-
private Supplier<String> notANumberUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true) final JsonElement input) {
39+
private Supplier<String> notANumberUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true, name = "input") final JsonElement input) {
4040
return () -> "Element is not a number: " + input;
4141
}
4242

@@ -47,7 +47,7 @@ private Supplier<String> notANumberUseBetterErrorMessage(Supplier<String> messag
4747
target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;"
4848
)
4949
)
50-
private Supplier<String> notABooleanUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true) final JsonElement input) {
50+
private Supplier<String> notABooleanUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true, name = "input") final JsonElement input) {
5151
return () -> "Element is not a boolean: " + input;
5252
}
5353

@@ -58,7 +58,7 @@ private Supplier<String> notABooleanUseBetterErrorMessage(Supplier<String> messa
5858
target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;"
5959
)
6060
)
61-
private Supplier<String> notAStringUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true) final JsonElement input) {
61+
private Supplier<String> notAStringUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true, name = "input") final JsonElement input) {
6262
return () -> "Element is not a string: " + input;
6363
}
6464

@@ -69,7 +69,7 @@ private Supplier<String> notAStringUseBetterErrorMessage(Supplier<String> messag
6969
target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;"
7070
)
7171
)
72-
private Supplier<String> notAMapUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true) final JsonElement input) {
72+
private Supplier<String> notAMapUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true, name = "input") final JsonElement input) {
7373
return () -> "Element is not a map: " + input;
7474
}
7575

@@ -80,7 +80,7 @@ private Supplier<String> notAMapUseBetterErrorMessage(Supplier<String> message,
8080
target = "Lcom/mojang/serialization/DataResult;error(Ljava/util/function/Supplier;)Lcom/mojang/serialization/DataResult;"
8181
)
8282
)
83-
private Supplier<String> notAListUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true) final JsonElement input) {
83+
private Supplier<String> notAListUseBetterErrorMessage(Supplier<String> message, @Local(argsOnly = true, name = "input") final JsonElement input) {
8484
return () -> "Element is not a list: " + input;
8585
}
8686

0 commit comments

Comments
 (0)