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,10 +18,16 @@ dependencies {
annotationProcessor 'org.projectlombok:lombok:1.18.32'
}
loom {
accessWidenerPath = file("src/main/resources/uniform.accesswidener")
}
shadowJar {
configurations = [project.configurations.shadow]
exclude('net.fabricmc:.*')
exclude('net.kyori:.*')
exclude '/mappings/*'
}
}
shadowJar.finalizedBy(remapJar)

@ -28,41 +28,50 @@ import net.minecraft.command.argument.ArgumentTypes;
import net.minecraft.command.argument.serialize.ArgumentSerializer;
import net.minecraft.command.suggestion.SuggestionProviders;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(targets = "net/minecraft/network/packet/s2c/play/CommandTreeS2CPacket$ArgumentNode")
public class ArgumentNodeMixin {
@Mutable
@Final
@Shadow
private String name;
@Mutable
@Final
@Shadow
private ArgumentSerializer.ArgumentTypeProperties<?> properties;
@Mutable
@Final
@Nullable
@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"))
private <A> void onConstruct(ArgumentCommandNode<CommandSource, A> node, CallbackInfo ci) {
this.name = node.getName();
this.id = node.getCustomSuggestions() != null ? SuggestionProviders.computeId(node.getCustomSuggestions()) : null;
@Redirect(method = "<init>(Lcom/mojang/brigadier/tree/ArgumentCommandNode;)V", at = @At("HEAD"))
private static <A> ArgumentNodeMixin onConstruct(ArgumentCommandNode<CommandSource, A> node) {
ArgumentSerializer.ArgumentTypeProperties<?> properties;
try {
this.properties = ArgumentTypes.get(node.getType()).getArgumentTypeProperties(node.getType());
properties = ArgumentTypes.get(node.getType()).getArgumentTypeProperties(node.getType());
} 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
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",
"mixins": [
"compatibilityLevel": "JAVA_17",
"mixins": [],
"server": [
"ArgumentNodeMixin"
]
],
"injectors": {
"defaultRequire": 1
}
}

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

@ -28,41 +28,50 @@ import net.minecraft.command.argument.ArgumentTypes;
import net.minecraft.command.argument.serialize.ArgumentSerializer;
import net.minecraft.command.suggestion.SuggestionProviders;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(targets = "net/minecraft/network/packet/s2c/play/CommandTreeS2CPacket$ArgumentNode")
public class ArgumentNodeMixin {
@Mutable
@Final
@Shadow
private String name;
@Mutable
@Final
@Shadow
private ArgumentSerializer.ArgumentTypeProperties<?> properties;
@Mutable
@Final
@Nullable
@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"))
private <A> void onConstruct(ArgumentCommandNode<CommandSource, A> node, CallbackInfo ci) {
this.name = node.getName();
this.id = node.getCustomSuggestions() != null ? SuggestionProviders.computeId(node.getCustomSuggestions()) : null;
@Redirect(method = "<init>(Lcom/mojang/brigadier/tree/ArgumentCommandNode;)V", at = @At("HEAD"))
private static <A> ArgumentNodeMixin onConstruct(ArgumentCommandNode<CommandSource, A> node) {
ArgumentSerializer.ArgumentTypeProperties<?> properties;
try {
this.properties = ArgumentTypes.get(node.getType()).getArgumentTypeProperties(node.getType());
properties = ArgumentTypes.get(node.getType()).getArgumentTypeProperties(node.getType());
} 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
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",
"mixins": [
"compatibilityLevel": "JAVA_17",
"mixins": [],
"server": [
"ArgumentNodeMixin"
]
],
"injectors": {
"defaultRequire": 1
}
}

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