build: update mixins

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

@ -18,6 +18,10 @@ dependencies {
annotationProcessor 'org.projectlombok:lombok:1.18.32' annotationProcessor 'org.projectlombok:lombok:1.18.32'
} }
loom {
accessWidenerPath = file("src/main/resources/uniform.accesswidener")
}
shadowJar { shadowJar {
configurations = [project.configurations.shadow] configurations = [project.configurations.shadow]
@ -25,3 +29,5 @@ shadowJar {
exclude('net.kyori:.*') exclude('net.kyori:.*')
exclude '/mappings/*' exclude '/mappings/*'
} }
shadowJar.finalizedBy(remapJar)

@ -28,14 +28,12 @@ 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.util.Identifier; import net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable; import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow; 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.Inject; import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(targets = "net/minecraft/network/packet/s2c/play/CommandTreeS2CPacket$ArgumentNode") @Mixin(targets = "net/minecraft/network/packet/s2c/play/CommandTreeS2CPacket$ArgumentNode")
public class ArgumentNodeMixin { public class ArgumentNodeMixin {
@ -44,25 +42,36 @@ public class ArgumentNodeMixin {
@Final @Final
@Shadow @Shadow
private String name; private String name;
@Mutable @Mutable
@Final @Final
@Shadow @Shadow
private ArgumentSerializer.ArgumentTypeProperties<?> properties; private ArgumentSerializer.ArgumentTypeProperties<?> properties;
@Mutable @Mutable
@Final @Final
@Nullable
@Shadow @Shadow
private Identifier id; // Actually, the suggestion provider. Possibly the worst field name in the entire yarn mappings? 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;
}
@Inject(method = "<init>(Lcom/mojang/brigadier/tree/ArgumentCommandNode;)V", at = @At("RETURN")) @Redirect(method = "<init>(Lcom/mojang/brigadier/tree/ArgumentCommandNode;)V", at = @At("HEAD"))
private <A> void onConstruct(ArgumentCommandNode<CommandSource, A> node, CallbackInfo ci) { private static <A> ArgumentNodeMixin onConstruct(ArgumentCommandNode<CommandSource, A> node) {
this.name = node.getName(); ArgumentSerializer.ArgumentTypeProperties<?> properties;
this.id = node.getCustomSuggestions() != null ? SuggestionProviders.computeId(node.getCustomSuggestions()) : null;
try { try {
this.properties = ArgumentTypes.get(node.getType()).getArgumentTypeProperties(node.getType()); properties = ArgumentTypes.get(node.getType()).getArgumentTypeProperties(node.getType());
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
this.properties = ArgumentTypes.get(StringArgumentType.string()).getArgumentTypeProperties(StringArgumentType.string()); properties = ArgumentTypes.get(StringArgumentType.string()).getArgumentTypeProperties(StringArgumentType.string());
} }
return new ArgumentNodeMixin(
node.getName(),
properties,
node.getCustomSuggestions() != null ? SuggestionProviders.computeId(node.getCustomSuggestions()) : null
);
} }
} }

@ -1,3 +1,4 @@
accessWidener v2 named accessWidener v2 named
accessible 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

@ -1,6 +1,13 @@
{ {
"required": true,
"minVersion": "0.8",
"package": "net.william278.uniform.fabric.mixins", "package": "net.william278.uniform.fabric.mixins",
"mixins": [ "compatibilityLevel": "JAVA_17",
"mixins": [],
"server": [
"ArgumentNodeMixin" "ArgumentNodeMixin"
] ],
"injectors": {
"defaultRequire": 1
}
} }

@ -18,6 +18,10 @@ dependencies {
annotationProcessor 'org.projectlombok:lombok:1.18.32' annotationProcessor 'org.projectlombok:lombok:1.18.32'
} }
loom {
accessWidenerPath = file("src/main/resources/uniform.accesswidener")
}
shadowJar { shadowJar {
configurations = [project.configurations.shadow] configurations = [project.configurations.shadow]
@ -25,3 +29,5 @@ shadowJar {
exclude('net.kyori:.*') exclude('net.kyori:.*')
exclude '/mappings/*' exclude '/mappings/*'
} }
shadowJar.finalizedBy(remapJar)

@ -28,14 +28,12 @@ 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.util.Identifier; import net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable; import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow; 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.Inject; import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(targets = "net/minecraft/network/packet/s2c/play/CommandTreeS2CPacket$ArgumentNode") @Mixin(targets = "net/minecraft/network/packet/s2c/play/CommandTreeS2CPacket$ArgumentNode")
public class ArgumentNodeMixin { public class ArgumentNodeMixin {
@ -44,25 +42,36 @@ public class ArgumentNodeMixin {
@Final @Final
@Shadow @Shadow
private String name; private String name;
@Mutable @Mutable
@Final @Final
@Shadow @Shadow
private ArgumentSerializer.ArgumentTypeProperties<?> properties; private ArgumentSerializer.ArgumentTypeProperties<?> properties;
@Mutable @Mutable
@Final @Final
@Nullable
@Shadow @Shadow
private Identifier id; // Actually, the suggestion provider. Possibly the worst field name in the entire yarn mappings? 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;
}
@Inject(method = "<init>(Lcom/mojang/brigadier/tree/ArgumentCommandNode;)V", at = @At("RETURN")) @Redirect(method = "<init>(Lcom/mojang/brigadier/tree/ArgumentCommandNode;)V", at = @At("HEAD"))
private <A> void onConstruct(ArgumentCommandNode<CommandSource, A> node, CallbackInfo ci) { private static <A> ArgumentNodeMixin onConstruct(ArgumentCommandNode<CommandSource, A> node) {
this.name = node.getName(); ArgumentSerializer.ArgumentTypeProperties<?> properties;
this.id = node.getCustomSuggestions() != null ? SuggestionProviders.computeId(node.getCustomSuggestions()) : null;
try { try {
this.properties = ArgumentTypes.get(node.getType()).getArgumentTypeProperties(node.getType()); properties = ArgumentTypes.get(node.getType()).getArgumentTypeProperties(node.getType());
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
this.properties = ArgumentTypes.get(StringArgumentType.string()).getArgumentTypeProperties(StringArgumentType.string()); properties = ArgumentTypes.get(StringArgumentType.string()).getArgumentTypeProperties(StringArgumentType.string());
} }
return new ArgumentNodeMixin(
node.getName(),
properties,
node.getCustomSuggestions() != null ? SuggestionProviders.computeId(node.getCustomSuggestions()) : null
);
} }
} }

@ -1,3 +1,4 @@
accessWidener v2 named accessWidener v2 named
accessible 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

@ -1,6 +1,13 @@
{ {
"required": true,
"minVersion": "0.8",
"package": "net.william278.uniform.fabric.mixins", "package": "net.william278.uniform.fabric.mixins",
"mixins": [ "compatibilityLevel": "JAVA_17",
"mixins": [],
"server": [
"ArgumentNodeMixin" "ArgumentNodeMixin"
] ],
"injectors": {
"defaultRequire": 1
}
} }

@ -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.8 library_version=1.0.9
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