2025-11-24 22:52:51 +03:00

32 lines
1.1 KiB
Java

/*
* Decompiled with CFR 0.152.
*/
package net.minecraft.commands.execution.tasks;
import java.util.function.Consumer;
import net.minecraft.commands.CommandResultCallback;
import net.minecraft.commands.ExecutionCommandSource;
import net.minecraft.commands.execution.EntryAction;
import net.minecraft.commands.execution.ExecutionContext;
import net.minecraft.commands.execution.ExecutionControl;
import net.minecraft.commands.execution.Frame;
public class IsolatedCall<T extends ExecutionCommandSource<T>>
implements EntryAction<T> {
private final Consumer<ExecutionControl<T>> taskProducer;
private final CommandResultCallback output;
public IsolatedCall(Consumer<ExecutionControl<T>> taskOutput, CommandResultCallback output) {
this.taskProducer = taskOutput;
this.output = output;
}
@Override
public void execute(ExecutionContext<T> context, Frame frame) {
int newFrameDepth = frame.depth() + 1;
Frame newFrame = new Frame(newFrameDepth, this.output, context.frameControlForDepth(newFrameDepth));
this.taskProducer.accept(ExecutionControl.create(context, newFrame));
}
}