Spaces:
Build error
Build error
File size: 1,471 Bytes
d46f4a3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
package net.minecraft.data.info;
import com.mojang.brigadier.CommandDispatcher;
import java.nio.file.Path;
import java.util.concurrent.CompletableFuture;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.commands.synchronization.ArgumentUtils;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.CachedOutput;
import net.minecraft.data.DataProvider;
import net.minecraft.data.PackOutput;
public class CommandsReport implements DataProvider {
private final PackOutput output;
private final CompletableFuture<HolderLookup.Provider> registries;
public CommandsReport(PackOutput p_256167_, CompletableFuture<HolderLookup.Provider> p_256506_) {
this.output = p_256167_;
this.registries = p_256506_;
}
@Override
public CompletableFuture<?> run(CachedOutput p_253721_) {
Path path = this.output.getOutputFolder(PackOutput.Target.REPORTS).resolve("commands.json");
return this.registries.thenCompose(p_256367_ -> {
CommandDispatcher<CommandSourceStack> commanddispatcher = new Commands(Commands.CommandSelection.ALL, Commands.createValidationContext(p_256367_)).getDispatcher();
return DataProvider.saveStable(p_253721_, ArgumentUtils.serializeNodeToJson(commanddispatcher, commanddispatcher.getRoot()), path);
});
}
@Override
public final String getName() {
return "Command Syntax";
}
} |