fix return value of run not captured

This commit is contained in:
gnembon committed 2025-10-12 14:04:46 +02:00
1 parent f2b7aaf28c
commit ca5f69a476
5 files changed
+44 -3

No files matched your search

@@ -1,5 +1,6 @@
package carpet.script.utils;
import carpet.fakes.CommandSourceStackInterface;
import carpet.script.external.Vanilla;
import net.minecraft.commands.CommandResultCallback;
import net.minecraft.commands.CommandSigningContext;
@@ -66,6 +67,7 @@ public class SnoopyCommandSource extends CommandSourceStack
this.chatOutput = chatOutput;
this.signingContext = original.getSigningContext();
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)
@@ -89,6 +91,7 @@ public class SnoopyCommandSource extends CommandSourceStack
this.chatOutput = output;
this.signingContext = CommandSigningContext.ANONYMOUS;
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,
@@ -114,6 +117,7 @@ public class SnoopyCommandSource extends CommandSourceStack
this.chatOutput = chatOutput;
this.signingContext = context;
this.taskChainer = chainer;
((CommandSourceStackInterface) this).setupPrivates(false, consumer, entityAnchor, context, chainer);
}
@Override