/* * Decompiled with CFR 0.152. */ package net.minecraft.commands.execution.tasks; import java.util.List; import net.minecraft.commands.execution.CommandQueueEntry; import net.minecraft.commands.execution.EntryAction; import net.minecraft.commands.execution.ExecutionContext; import net.minecraft.commands.execution.Frame; public class ContinuationTask implements EntryAction { private final TaskProvider taskFactory; private final List

arguments; private final CommandQueueEntry selfEntry; private int index; private ContinuationTask(TaskProvider taskFactory, List

arguments, Frame frame) { this.taskFactory = taskFactory; this.arguments = arguments; this.selfEntry = new CommandQueueEntry(frame, this); } @Override public void execute(ExecutionContext context, Frame frame) { P argument = this.arguments.get(this.index); context.queueNext(this.taskFactory.create(frame, argument)); if (++this.index < this.arguments.size()) { context.queueNext(this.selfEntry); } } public static void schedule(ExecutionContext context, Frame frame, List

arguments, TaskProvider taskFactory) { int argumentCount = arguments.size(); switch (argumentCount) { case 0: { break; } case 1: { context.queueNext(taskFactory.create(frame, arguments.get(0))); break; } case 2: { context.queueNext(taskFactory.create(frame, arguments.get(0))); context.queueNext(taskFactory.create(frame, arguments.get(1))); break; } default: { context.queueNext(new ContinuationTask(taskFactory, arguments, (Frame)frame).selfEntry); } } } @FunctionalInterface public static interface TaskProvider { public CommandQueueEntry create(Frame var1, P var2); } }