Skip to content

Instantly share code, notes, and snippets.

@bconlon1
Created June 19, 2022 23:15
Show Gist options
  • Save bconlon1/0591bf856632c508d3f3950de9f91b49 to your computer and use it in GitHub Desktop.
Save bconlon1/0591bf856632c508d3f3950de9f91b49 to your computer and use it in GitHub Desktop.
public class AetherDataGenerator<T> {
public DataProvider create(DataGenerator generator, ExistingFileHelper helper, DeferredRegister<T> registry, ResourceKey<Registry<T>> registryKey) {
RegistryAccess registryAccess = RegistryAccess.builtinCopy();
RegistryOps<JsonElement> registryOps = RegistryOps.create(JsonOps.INSTANCE, registryAccess);
Map<ResourceLocation, T> map = new HashMap<>();
for (RegistryObject<T> object : registry.getEntries()) {
map.put(object.getId(), object.get());
}
return JsonCodecProvider.forDatapackRegistry(generator, helper, Aether.MODID, registryOps, registryKey, map);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment