diff --git a/fabric-1.20.1/src/main/java/net/william278/uniform/fabric/mixins/ArgumentNodeMixin.java b/fabric-1.20.1/src/main/java/net/william278/uniform/fabric/mixins/ArgumentNodeMixin.java index 9c64f68..1f291c1 100644 --- a/fabric-1.20.1/src/main/java/net/william278/uniform/fabric/mixins/ArgumentNodeMixin.java +++ b/fabric-1.20.1/src/main/java/net/william278/uniform/fabric/mixins/ArgumentNodeMixin.java @@ -27,47 +27,32 @@ import net.minecraft.command.CommandSource; import net.minecraft.command.argument.ArgumentTypes; import net.minecraft.command.argument.serialize.ArgumentSerializer; import net.minecraft.command.suggestion.SuggestionProviders; +import net.minecraft.network.packet.s2c.play.CommandTreeS2CPacket.ArgumentNode; import net.minecraft.util.Identifier; -import org.spongepowered.asm.mixin.Final; +import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Mutable; -import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.gen.Invoker; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -@Mixin(targets = "net/minecraft/network/packet/s2c/play/CommandTreeS2CPacket$ArgumentNode") +@Mixin(ArgumentNode.class) public class ArgumentNodeMixin { - - @Mutable - @Final - @Shadow - private String name; - - @Mutable - @Final - @Shadow - private ArgumentSerializer.ArgumentTypeProperties properties; - - @Mutable - @Final - @Shadow - private Identifier id; // Worst mapping name in the entirety of yarn. Actually suggestion providers. Lmao. - - ArgumentNodeMixin(String name, ArgumentSerializer.ArgumentTypeProperties properties, Identifier id) { - this.name = name; - this.properties = properties; - this.id = id; + + @Invoker("") + static ArgumentNode createArgumentNode(String name, ArgumentSerializer.ArgumentTypeProperties properties, @Nullable Identifier id) { + throw new AssertionError(); } @Redirect(method = "(Lcom/mojang/brigadier/tree/ArgumentCommandNode;)V", at = @At("HEAD")) - private static ArgumentNodeMixin onConstruct(ArgumentCommandNode node) { + static ArgumentNode onConstruct(ArgumentCommandNode node) { ArgumentSerializer.ArgumentTypeProperties properties; try { properties = ArgumentTypes.get(node.getType()).getArgumentTypeProperties(node.getType()); } catch (IllegalArgumentException e) { properties = ArgumentTypes.get(StringArgumentType.string()).getArgumentTypeProperties(StringArgumentType.string()); } - return new ArgumentNodeMixin( + + return createArgumentNode( node.getName(), properties, node.getCustomSuggestions() != null ? SuggestionProviders.computeId(node.getCustomSuggestions()) : null diff --git a/fabric-1.20.1/src/main/resources/uniform.accesswidener b/fabric-1.20.1/src/main/resources/uniform.accesswidener index 1a83124..95b5d4d 100644 --- a/fabric-1.20.1/src/main/resources/uniform.accesswidener +++ b/fabric-1.20.1/src/main/resources/uniform.accesswidener @@ -1,4 +1,3 @@ accessWidener v2 named -extendable class net/minecraft/network/packet/s2c/play/CommandTreeS2CPacket$ArgumentNode -accessible method net/minecraft/network/packet/s2c/play/CommandTreeS2CPacket$ArgumentNode (Ljava/lang/String;Lnet/minecraft/command/argument/serialize/ArgumentSerializer$ArgumentTypeProperties;Lnet/minecraft/util/Identifier;)V \ No newline at end of file +extendable class net/minecraft/network/packet/s2c/play/CommandTreeS2CPacket$ArgumentNode \ No newline at end of file diff --git a/fabric-1.20.6/src/main/java/net/william278/uniform/fabric/mixins/ArgumentNodeMixin.java b/fabric-1.20.6/src/main/java/net/william278/uniform/fabric/mixins/ArgumentNodeMixin.java index 9c64f68..1f291c1 100644 --- a/fabric-1.20.6/src/main/java/net/william278/uniform/fabric/mixins/ArgumentNodeMixin.java +++ b/fabric-1.20.6/src/main/java/net/william278/uniform/fabric/mixins/ArgumentNodeMixin.java @@ -27,47 +27,32 @@ import net.minecraft.command.CommandSource; import net.minecraft.command.argument.ArgumentTypes; import net.minecraft.command.argument.serialize.ArgumentSerializer; import net.minecraft.command.suggestion.SuggestionProviders; +import net.minecraft.network.packet.s2c.play.CommandTreeS2CPacket.ArgumentNode; import net.minecraft.util.Identifier; -import org.spongepowered.asm.mixin.Final; +import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Mutable; -import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.gen.Invoker; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -@Mixin(targets = "net/minecraft/network/packet/s2c/play/CommandTreeS2CPacket$ArgumentNode") +@Mixin(ArgumentNode.class) public class ArgumentNodeMixin { - - @Mutable - @Final - @Shadow - private String name; - - @Mutable - @Final - @Shadow - private ArgumentSerializer.ArgumentTypeProperties properties; - - @Mutable - @Final - @Shadow - private Identifier id; // Worst mapping name in the entirety of yarn. Actually suggestion providers. Lmao. - - ArgumentNodeMixin(String name, ArgumentSerializer.ArgumentTypeProperties properties, Identifier id) { - this.name = name; - this.properties = properties; - this.id = id; + + @Invoker("") + static ArgumentNode createArgumentNode(String name, ArgumentSerializer.ArgumentTypeProperties properties, @Nullable Identifier id) { + throw new AssertionError(); } @Redirect(method = "(Lcom/mojang/brigadier/tree/ArgumentCommandNode;)V", at = @At("HEAD")) - private static ArgumentNodeMixin onConstruct(ArgumentCommandNode node) { + static ArgumentNode onConstruct(ArgumentCommandNode node) { ArgumentSerializer.ArgumentTypeProperties properties; try { properties = ArgumentTypes.get(node.getType()).getArgumentTypeProperties(node.getType()); } catch (IllegalArgumentException e) { properties = ArgumentTypes.get(StringArgumentType.string()).getArgumentTypeProperties(StringArgumentType.string()); } - return new ArgumentNodeMixin( + + return createArgumentNode( node.getName(), properties, node.getCustomSuggestions() != null ? SuggestionProviders.computeId(node.getCustomSuggestions()) : null diff --git a/fabric-1.20.6/src/main/resources/uniform.accesswidener b/fabric-1.20.6/src/main/resources/uniform.accesswidener index 1a83124..95b5d4d 100644 --- a/fabric-1.20.6/src/main/resources/uniform.accesswidener +++ b/fabric-1.20.6/src/main/resources/uniform.accesswidener @@ -1,4 +1,3 @@ accessWidener v2 named -extendable class net/minecraft/network/packet/s2c/play/CommandTreeS2CPacket$ArgumentNode -accessible method net/minecraft/network/packet/s2c/play/CommandTreeS2CPacket$ArgumentNode (Ljava/lang/String;Lnet/minecraft/command/argument/serialize/ArgumentSerializer$ArgumentTypeProperties;Lnet/minecraft/util/Identifier;)V \ No newline at end of file +extendable class net/minecraft/network/packet/s2c/play/CommandTreeS2CPacket$ArgumentNode \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 5ab072b..8635fbc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,6 +3,6 @@ javaVersion=17 org.gradle.jvmargs='-Dfile.encoding=UTF-8' org.gradle.daemon=true -library_version=1.0.9 +library_version=1.0.10 library_archive=uniform library_description=Cross-platform wrapper for making Brigadier commands, based on BrigadierWrapper by Tofaa2, itself inspired by emortalmcs command system. \ No newline at end of file