Updated to 23w42a

Signed-off-by: shedaniel <daniel@shedaniel.me>
This commit is contained in:
shedaniel
2023-10-19 08:55:38 +08:00
parent c0d6cb9e6b
commit 98f357d833
2 changed files with 10 additions and 9 deletions

View File

@@ -21,6 +21,7 @@ package dev.architectury.mixin.fabric;
import com.google.common.base.Throwables;
import com.mojang.brigadier.ParseResults;
import com.mojang.brigadier.context.ContextChain;
import dev.architectury.event.events.common.CommandPerformEvent;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
@@ -28,13 +29,13 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(Commands.class)
public class MixinCommands {
@ModifyVariable(method = "performCommand",
@ModifyVariable(method = "finishParsing",
at = @At(value = "INVOKE", target = "Lnet/minecraft/commands/Commands;validateParseResults(Lcom/mojang/brigadier/ParseResults;)V", remap = false), argsOnly = true)
private ParseResults<CommandSourceStack> performCommand(ParseResults<CommandSourceStack> results) {
private static ParseResults<CommandSourceStack> finishParsing(ParseResults<CommandSourceStack> results) {
var event = new CommandPerformEvent(results, null);
if (CommandPerformEvent.EVENT.invoker().act(event).isPresent()) {
if (event.getThrowable() != null) {
@@ -45,9 +46,9 @@ public class MixinCommands {
return event.getResults();
}
@Inject(method = "performCommand",
@Inject(method = "finishParsing",
at = @At(value = "INVOKE", target = "Lnet/minecraft/commands/Commands;validateParseResults(Lcom/mojang/brigadier/ParseResults;)V", remap = false), cancellable = true)
private void performCommand(ParseResults<CommandSourceStack> results, String command, CallbackInfo ci) {
if (results == null) ci.cancel();
private static void finishParsing(ParseResults<CommandSourceStack> results, String command, CommandSourceStack stack, CallbackInfoReturnable<ContextChain<CommandSourceStack>> cir) {
if (results == null) cir.setReturnValue(null);
}
}

View File

@@ -3,8 +3,8 @@ org.gradle.daemon=false
platforms=fabric
minecraft_version=23w41a
supported_version=23w41a
minecraft_version=23w42a
supported_version=23w42a
artifact_type=beta
@@ -14,7 +14,7 @@ base_version=11.0
maven_group=dev.architectury
fabric_loader_version=0.14.23
fabric_api_version=0.90.1+1.20.3
fabric_api_version=0.90.3+1.20.3
mod_menu_version=7.0.0
forge_version=48.0.1