fix return value of run not captured
This commit is contained in:
1 parent
f2b7aaf28c
commit
ca5f69a476
5 files changed
+44
-3
No files matched your search
@@ -0,0 +1,10 @@
|
|||||||
|
package carpet.fakes;
|
||||||
|
|
||||||
|
import net.minecraft.commands.CommandResultCallback;
|
||||||
|
import net.minecraft.commands.CommandSigningContext;
|
||||||
|
import net.minecraft.commands.arguments.EntityAnchorArgument;
|
||||||
|
import net.minecraft.util.TaskChainer;
|
||||||
|
|
||||||
|
public interface CommandSourceStackInterface {
|
||||||
|
void setupPrivates(boolean bl, CommandResultCallback commandResultCallback, EntityAnchorArgument.Anchor anchor, CommandSigningContext commandSigningContext, TaskChainer taskChainer);
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.fakes.CommandSourceStackInterface;
|
||||||
|
import net.minecraft.commands.CommandResultCallback;
|
||||||
|
import net.minecraft.commands.CommandSigningContext;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
import net.minecraft.commands.arguments.EntityAnchorArgument;
|
||||||
|
import net.minecraft.util.TaskChainer;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Mutable;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
|
@Mixin(CommandSourceStack.class)
|
||||||
|
public class CommandSourceStack_scarpetMixin implements CommandSourceStackInterface {
|
||||||
|
@Mutable @Shadow private boolean silent;
|
||||||
|
@Mutable @Shadow private CommandResultCallback resultCallback;
|
||||||
|
@Mutable @Shadow private EntityAnchorArgument.Anchor anchor;
|
||||||
|
@Mutable @Shadow private CommandSigningContext signingContext;
|
||||||
|
@Mutable @Shadow private TaskChainer chatMessageChainer;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setupPrivates(boolean bl, CommandResultCallback commandResultCallback, EntityAnchorArgument.Anchor anchor, CommandSigningContext commandSigningContext, TaskChainer taskChainer) {
|
||||||
|
this.silent = bl;
|
||||||
|
this.resultCallback = commandResultCallback;
|
||||||
|
this.anchor = anchor;
|
||||||
|
this.signingContext = commandSigningContext;
|
||||||
|
this.chatMessageChainer = taskChainer;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package carpet.script.utils;
|
package carpet.script.utils;
|
||||||
|
|
||||||
|
import carpet.fakes.CommandSourceStackInterface;
|
||||||
import carpet.script.external.Vanilla;
|
import carpet.script.external.Vanilla;
|
||||||
import net.minecraft.commands.CommandResultCallback;
|
import net.minecraft.commands.CommandResultCallback;
|
||||||
import net.minecraft.commands.CommandSigningContext;
|
import net.minecraft.commands.CommandSigningContext;
|
||||||
@@ -66,6 +67,7 @@ public class SnoopyCommandSource extends CommandSourceStack
|
|||||||
this.chatOutput = chatOutput;
|
this.chatOutput = chatOutput;
|
||||||
this.signingContext = original.getSigningContext();
|
this.signingContext = original.getSigningContext();
|
||||||
this.taskChainer = TaskChainer.immediate(original.getServer());
|
this.taskChainer = TaskChainer.immediate(original.getServer());
|
||||||
|
((CommandSourceStackInterface) this).setupPrivates(false, (b, i) -> returnValue[0] = OptionalLong.of(i), EntityAnchorArgument.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(original.getServer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public SnoopyCommandSource(ServerPlayer player, Component[] error, List<Component> output, int [] result)
|
public SnoopyCommandSource(ServerPlayer player, Component[] error, List<Component> output, int [] result)
|
||||||
@@ -89,6 +91,7 @@ public class SnoopyCommandSource extends CommandSourceStack
|
|||||||
this.chatOutput = output;
|
this.chatOutput = output;
|
||||||
this.signingContext = CommandSigningContext.ANONYMOUS;
|
this.signingContext = CommandSigningContext.ANONYMOUS;
|
||||||
this.taskChainer = TaskChainer.immediate(player.level().getServer());
|
this.taskChainer = TaskChainer.immediate(player.level().getServer());
|
||||||
|
((CommandSourceStackInterface) this).setupPrivates(false, (b, i) -> result[0] = i, EntityAnchorArgument.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(player.level().getServer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private SnoopyCommandSource(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, PermissionSet level, String simpleName, Component name, MinecraftServer server, @Nullable Entity entity, CommandResultCallback consumer, EntityAnchorArgument.Anchor entityAnchor, CommandSigningContext context, TaskChainer chainer,
|
private SnoopyCommandSource(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, PermissionSet level, String simpleName, Component name, MinecraftServer server, @Nullable Entity entity, CommandResultCallback consumer, EntityAnchorArgument.Anchor entityAnchor, CommandSigningContext context, TaskChainer chainer,
|
||||||
@@ -114,6 +117,7 @@ public class SnoopyCommandSource extends CommandSourceStack
|
|||||||
this.chatOutput = chatOutput;
|
this.chatOutput = chatOutput;
|
||||||
this.signingContext = context;
|
this.signingContext = context;
|
||||||
this.taskChainer = chainer;
|
this.taskChainer = chainer;
|
||||||
|
((CommandSourceStackInterface) this).setupPrivates(false, consumer, entityAnchor, context, chainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -8,11 +8,8 @@ accessible class net/minecraft/world/level/border/WorldBorder$StaticBorderExtent
|
|||||||
accessible class net/minecraft/server/MinecraftServer$ReloadableResources
|
accessible class net/minecraft/server/MinecraftServer$ReloadableResources
|
||||||
accessible class net/minecraft/world/level/biome/Biome$ClimateSettings
|
accessible class net/minecraft/world/level/biome/Biome$ClimateSettings
|
||||||
accessible class net/minecraft/world/level/block/entity/SculkSensorBlockEntity$VibrationUser
|
accessible class net/minecraft/world/level/block/entity/SculkSensorBlockEntity$VibrationUser
|
||||||
#accessible class net/minecraft/commands/CommandSourceStack
|
|
||||||
|
|
||||||
#TODO fields and methods should be fetched via interfaces unless there is a good reason not to
|
#TODO fields and methods should be fetched via interfaces unless there is a good reason not to
|
||||||
#accessible method net/minecraft/commands/CommandSourceStack <init> (Lnet/minecraft/commands/CommandSource;Lnet/minecraft/world/phys/Vec3;Lnet/minecraft/world/phys/Vec2;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/server/permissions/PermissionSet;Ljava/lang/String;Lnet/minecraft/network/chat/Component;Lnet/minecraft/server/MinecraftServer;Lnet/minecraft/world/entity/Entity;BLnet/minecraft/commands/CommandResultCallback;Lnet/minecraft/commands/arguments/EntityAnchorArgument$Anchor;Lnet/minecraft/commands/CommandSigningContext;Lnet/minecraft/util/TaskChainer;)V
|
|
||||||
accessible method net/minecraft/world/level/border/WorldBorder getListeners ()Ljava/util/List;
|
accessible method net/minecraft/world/level/border/WorldBorder getListeners ()Ljava/util/List;
|
||||||
accessible method net/minecraft/world/level/redstone/DefaultRedstoneWireEvaluator calculateTargetStrength (Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)I
|
accessible method net/minecraft/world/level/redstone/DefaultRedstoneWireEvaluator calculateTargetStrength (Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)I
|
||||||
|
|
||||||
accessible field net/minecraft/world/level/block/state/BlockBehaviour UPDATE_SHAPE_ORDER [Lnet/minecraft/core/Direction;
|
accessible field net/minecraft/world/level/block/state/BlockBehaviour UPDATE_SHAPE_ORDER [Lnet/minecraft/core/Direction;
|
||||||
@@ -148,6 +148,7 @@
|
|||||||
"CommandNode_scarpetCommandsMixin",
|
"CommandNode_scarpetCommandsMixin",
|
||||||
"CommandDispatcher_scarpetCommandsMixin",
|
"CommandDispatcher_scarpetCommandsMixin",
|
||||||
"FoodData_scarpetMixin",
|
"FoodData_scarpetMixin",
|
||||||
|
"CommandSourceStack_scarpetMixin",
|
||||||
|
|
||||||
"BlockInput_scarpetMixin",
|
"BlockInput_scarpetMixin",
|
||||||
"BlockPredicate_scarpetMixin",
|
"BlockPredicate_scarpetMixin",
|
||||||
|
|||||||
Reference in new issue
Block a user