build: adjust mixins to fix error

dependabot/gradle/org.projectlombok-lombok-1.18.34 1.0.10
William 5 months ago
parent ad3da1005f
commit 73559b32a4
No known key found for this signature in database

@ -27,47 +27,32 @@ import net.minecraft.command.CommandSource;
import net.minecraft.command.argument.ArgumentTypes; import net.minecraft.command.argument.ArgumentTypes;
import net.minecraft.command.argument.serialize.ArgumentSerializer; import net.minecraft.command.argument.serialize.ArgumentSerializer;
import net.minecraft.command.suggestion.SuggestionProviders; import net.minecraft.command.suggestion.SuggestionProviders;
import net.minecraft.network.packet.s2c.play.CommandTreeS2CPacket.ArgumentNode;
import net.minecraft.util.Identifier; 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.Mixin;
import org.spongepowered.asm.mixin.Mutable; import org.spongepowered.asm.mixin.gen.Invoker;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(targets = "net/minecraft/network/packet/s2c/play/CommandTreeS2CPacket$ArgumentNode") @Mixin(ArgumentNode.class)
public class ArgumentNodeMixin { public class ArgumentNodeMixin {
@Mutable @Invoker("<init>")
@Final static ArgumentNode createArgumentNode(String name, ArgumentSerializer.ArgumentTypeProperties<?> properties, @Nullable Identifier id) {
@Shadow throw new AssertionError();
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;
} }
@Redirect(method = "<init>(Lcom/mojang/brigadier/tree/ArgumentCommandNode;)V", at = @At("HEAD")) @Redirect(method = "<init>(Lcom/mojang/brigadier/tree/ArgumentCommandNode;)V", at = @At("HEAD"))
private static <A> ArgumentNodeMixin onConstruct(ArgumentCommandNode<CommandSource, A> node) { static <A> ArgumentNode onConstruct(ArgumentCommandNode<CommandSource, A> node) {
ArgumentSerializer.ArgumentTypeProperties<?> properties; ArgumentSerializer.ArgumentTypeProperties<?> properties;
try { try {
properties = ArgumentTypes.get(node.getType()).getArgumentTypeProperties(node.getType()); properties = ArgumentTypes.get(node.getType()).getArgumentTypeProperties(node.getType());
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
properties = ArgumentTypes.get(StringArgumentType.string()).getArgumentTypeProperties(StringArgumentType.string()); properties = ArgumentTypes.get(StringArgumentType.string()).getArgumentTypeProperties(StringArgumentType.string());
} }
return new ArgumentNodeMixin(
return createArgumentNode(
node.getName(), node.getName(),
properties, properties,
node.getCustomSuggestions() != null ? SuggestionProviders.computeId(node.getCustomSuggestions()) : null node.getCustomSuggestions() != null ? SuggestionProviders.computeId(node.getCustomSuggestions()) : null

@ -1,4 +1,3 @@
accessWidener v2 named accessWidener v2 named
extendable class net/minecraft/network/packet/s2c/play/CommandTreeS2CPacket$ArgumentNode extendable class net/minecraft/network/packet/s2c/play/CommandTreeS2CPacket$ArgumentNode
accessible method net/minecraft/network/packet/s2c/play/CommandTreeS2CPacket$ArgumentNode <init> (Ljava/lang/String;Lnet/minecraft/command/argument/serialize/ArgumentSerializer$ArgumentTypeProperties;Lnet/minecraft/util/Identifier;)V

@ -27,47 +27,32 @@ import net.minecraft.command.CommandSource;
import net.minecraft.command.argument.ArgumentTypes; import net.minecraft.command.argument.ArgumentTypes;
import net.minecraft.command.argument.serialize.ArgumentSerializer; import net.minecraft.command.argument.serialize.ArgumentSerializer;
import net.minecraft.command.suggestion.SuggestionProviders; import net.minecraft.command.suggestion.SuggestionProviders;
import net.minecraft.network.packet.s2c.play.CommandTreeS2CPacket.ArgumentNode;
import net.minecraft.util.Identifier; 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.Mixin;
import org.spongepowered.asm.mixin.Mutable; import org.spongepowered.asm.mixin.gen.Invoker;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(targets = "net/minecraft/network/packet/s2c/play/CommandTreeS2CPacket$ArgumentNode") @Mixin(ArgumentNode.class)
public class ArgumentNodeMixin { public class ArgumentNodeMixin {
@Mutable @Invoker("<init>")
@Final static ArgumentNode createArgumentNode(String name, ArgumentSerializer.ArgumentTypeProperties<?> properties, @Nullable Identifier id) {
@Shadow throw new AssertionError();
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;
} }
@Redirect(method = "<init>(Lcom/mojang/brigadier/tree/ArgumentCommandNode;)V", at = @At("HEAD")) @Redirect(method = "<init>(Lcom/mojang/brigadier/tree/ArgumentCommandNode;)V", at = @At("HEAD"))
private static <A> ArgumentNodeMixin onConstruct(ArgumentCommandNode<CommandSource, A> node) { static <A> ArgumentNode onConstruct(ArgumentCommandNode<CommandSource, A> node) {
ArgumentSerializer.ArgumentTypeProperties<?> properties; ArgumentSerializer.ArgumentTypeProperties<?> properties;
try { try {
properties = ArgumentTypes.get(node.getType()).getArgumentTypeProperties(node.getType()); properties = ArgumentTypes.get(node.getType()).getArgumentTypeProperties(node.getType());
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
properties = ArgumentTypes.get(StringArgumentType.string()).getArgumentTypeProperties(StringArgumentType.string()); properties = ArgumentTypes.get(StringArgumentType.string()).getArgumentTypeProperties(StringArgumentType.string());
} }
return new ArgumentNodeMixin(
return createArgumentNode(
node.getName(), node.getName(),
properties, properties,
node.getCustomSuggestions() != null ? SuggestionProviders.computeId(node.getCustomSuggestions()) : null node.getCustomSuggestions() != null ? SuggestionProviders.computeId(node.getCustomSuggestions()) : null

@ -1,4 +1,3 @@
accessWidener v2 named accessWidener v2 named
extendable class net/minecraft/network/packet/s2c/play/CommandTreeS2CPacket$ArgumentNode extendable class net/minecraft/network/packet/s2c/play/CommandTreeS2CPacket$ArgumentNode
accessible method net/minecraft/network/packet/s2c/play/CommandTreeS2CPacket$ArgumentNode <init> (Ljava/lang/String;Lnet/minecraft/command/argument/serialize/ArgumentSerializer$ArgumentTypeProperties;Lnet/minecraft/util/Identifier;)V

@ -3,6 +3,6 @@ javaVersion=17
org.gradle.jvmargs='-Dfile.encoding=UTF-8' org.gradle.jvmargs='-Dfile.encoding=UTF-8'
org.gradle.daemon=true org.gradle.daemon=true
library_version=1.0.9 library_version=1.0.10
library_archive=uniform library_archive=uniform
library_description=Cross-platform wrapper for making Brigadier commands, based on BrigadierWrapper by Tofaa2, itself inspired by emortalmcs command system. library_description=Cross-platform wrapper for making Brigadier commands, based on BrigadierWrapper by Tofaa2, itself inspired by emortalmcs command system.
Loading…
Cancel
Save