Use levels registry access for dump
This commit is contained in:
parent
db0c89e7e7
commit
f0d1f1e453
1 changed files with 3 additions and 4 deletions
|
@ -34,15 +34,14 @@ import java.nio.file.Files;
|
|||
|
||||
public class DumpDatapack {
|
||||
static int dumpDatapack(CommandContext<CommandSourceStack> ctx) {
|
||||
dumpDatapack();
|
||||
dumpDatapack(ctx.getSource().getLevel().registryAccess());
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
public static void dumpDatapack() {
|
||||
final RegistryAccess registryAccess = RegistryAccess.builtinCopy();
|
||||
public static void dumpDatapack(RegistryAccess registryAccess) {
|
||||
final RegistryOps<JsonElement> registryOps = RegistryOps.create(JsonOps.INSTANCE, registryAccess);
|
||||
GsonBuilder gsonBuilder = new GsonBuilder();
|
||||
gsonBuilder = gsonBuilder.setPrettyPrinting(); //Sets pretty formatting
|
||||
gsonBuilder = gsonBuilder.setPrettyPrinting();
|
||||
Gson gson = gsonBuilder.create();
|
||||
registryAccess.registries().forEach(r -> dumpDatapack(r, registryOps, gson));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue