mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2026-09-16 06:11:24 +00:00
Reformat JSON by wrapping CachedOutput
Rather than mixing-in to CachedOutput, we just wrap our DataProviders to use a custom CachedOutput which reformats the JSON before writing. This allows us to drop mixins for common+non-client code.
This commit is contained in:
@@ -58,7 +58,6 @@ minecraft {
|
||||
"--existing", project(":common").file("src/main/resources/"),
|
||||
"--existing", file("src/main/resources/"),
|
||||
)
|
||||
property("cct.pretty-json", "true")
|
||||
}
|
||||
|
||||
fun RunConfig.configureForGameTest() {
|
||||
@@ -110,7 +109,6 @@ mixin {
|
||||
add(sourceSets.main.get(), "computercraft.refmap.json")
|
||||
add(sourceSets.client.get(), "client-computercraft.refmap.json")
|
||||
|
||||
config("computercraft.mixins.json")
|
||||
config("computercraft-client.mixins.json")
|
||||
config("computercraft-client.forge.mixins.json")
|
||||
}
|
||||
|
||||
@@ -51,12 +51,12 @@ public class Generators {
|
||||
) implements DataProviders.GeneratorSink {
|
||||
@Override
|
||||
public <T extends DataProvider> T add(DataProvider.Factory<T> factory) {
|
||||
return generator.addProvider(factory);
|
||||
return generator.addProvider(p -> new PrettyDataProvider<>(factory.create(p))).provider();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void addFromCodec(String name, PackType type, String directory, Codec<T> codec, Consumer<BiConsumer<ResourceLocation, T>> output) {
|
||||
generator.addProvider(out -> {
|
||||
add(out -> {
|
||||
Map<ResourceLocation, T> map = new HashMap<>();
|
||||
output.accept(map::put);
|
||||
return new JsonCodecProvider<>(out, existingFiles, ComputerCraftAPI.MOD_ID, JsonOps.INSTANCE, type, directory, codec, map);
|
||||
|
||||
Reference in New Issue
Block a user