Additional logging
This commit is contained in:
parent
16c1d59d20
commit
e8b7bf07b8
1 changed files with 15 additions and 19 deletions
|
@ -18,7 +18,6 @@ import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
@ -49,26 +48,20 @@ public abstract class RegistriesDataProvider implements DataProvider {
|
||||||
|
|
||||||
return registriesFuture.thenCompose(registriesProvider -> CompletableFuture
|
return registriesFuture.thenCompose(registriesProvider -> CompletableFuture
|
||||||
.supplyAsync(() -> registries)
|
.supplyAsync(() -> registries)
|
||||||
.thenCompose(entries -> {
|
.thenCompose(entries -> CompletableFuture.runAsync(() -> {
|
||||||
final List<CompletableFuture<?>> futures = new ArrayList<>();
|
registries.acquireLock();
|
||||||
|
final RegistryOps<JsonElement> dynamicOps = RegistryOps.create(
|
||||||
|
JsonOps.INSTANCE,
|
||||||
|
registriesProvider
|
||||||
|
);
|
||||||
|
|
||||||
futures.add(CompletableFuture.runAsync(() -> {
|
for (RegistrySupplier.RegistryInfo<?> registryData : entries.allRegistries) {
|
||||||
registries.acquireLock();
|
serializeRegistry(
|
||||||
final RegistryOps<JsonElement> dynamicOps = RegistryOps.create(
|
cachedOutput, registriesProvider, dynamicOps, registryData
|
||||||
JsonOps.INSTANCE,
|
|
||||||
registriesProvider
|
|
||||||
);
|
);
|
||||||
|
}
|
||||||
for (RegistrySupplier.RegistryInfo<?> registryData : entries.allRegistries) {
|
registries.releaseLock();
|
||||||
serializeRegistry(
|
})));
|
||||||
cachedOutput, registriesProvider, dynamicOps, registryData
|
|
||||||
);
|
|
||||||
}
|
|
||||||
registries.releaseLock();
|
|
||||||
}));
|
|
||||||
|
|
||||||
return CompletableFuture.allOf(futures.toArray(CompletableFuture[]::new));
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> void serializeRegistry(
|
private <T> void serializeRegistry(
|
||||||
|
@ -120,6 +113,9 @@ public abstract class RegistriesDataProvider implements DataProvider {
|
||||||
));
|
));
|
||||||
if (optional.isPresent()) {
|
if (optional.isPresent()) {
|
||||||
DataProvider.saveStable(cachedOutput, optional.get(), path);
|
DataProvider.saveStable(cachedOutput, optional.get(), path);
|
||||||
|
LOGGER.info(path + " written");
|
||||||
|
} else {
|
||||||
|
LOGGER.warning(path + " is empty");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue