@@ -0,0 +1,2299 @@
+package info.u_team.u_team_core.data;%0A%0Aimport java.io.IOException;%0Aimport java.util.*;%0Aimport java.util.function.Supplier;%0Aimport java.util.stream.Collectors;%0A%0Aimport com.google.gson.JsonObject;%0A%0Aimport info.u_team.u_team_core.util.TriConsumer;%0Aimport net.minecraft.data.DirectoryCache;%0Aimport net.minecraft.util.*;%0Aimport net.minecraftforge.common.loot.*;%0A%0Apublic abstract class CommonGlobalLootModifiersProvider extends CommonProvider %7B%0A%09%0A%09protected boolean replace;%0A%09%0A%09public CommonGlobalLootModifiersProvider(GenerationData data) %7B%0A%09%09super(data);%0A%09%7D%0A%09%0A%09@Override%0A%09public void act(DirectoryCache cache) throws IOException %7B%0A%09%09final Map%3CString, Tuple%3CGlobalLootModifierSerializer%3C?%3E, JsonObject%3E%3E serializers = new TreeMap%3C%3E();%0A%09%09%0A%09%09registerGlobalLootModifiers((modifier, serializerSupplier, instance) -%3E %7B%0A%09%09%09final GlobalLootModifierSerializer%3CIGlobalLootModifier%3E serializer = serializerSupplier.get();%0A%09%09%09serializers.put(modifier, new Tuple%3C%3E(serializer, serializer.write(instance)));%0A%09%09%7D);%0A%09%09%0A%09%09final List%3CString%3E entries = serializers.entrySet().stream().map(entry -%3E %7B%0A%09%09%09final String name = entry.getKey();%0A%09%09%09final Tuple%3CGlobalLootModifierSerializer%3C?%3E, JsonObject%3E tuple = entry.getValue();%0A%09%09%09final JsonObject json = tuple.getB();%0A%09%09%09%0A%09%09%09json.addProperty(%22type%22, tuple.getA().getRegistryName().toString());%0A%09%09%09%0A%09%09%09try %7B%0A%09%09%09%09write(cache, json, resolveModData().resolve(%22loot_modifiers%22).resolve(name + %22.json%22));%0A%09%09%09%7D catch (final IOException ex) %7B%0A%09%09%09%09LOGGER.error(marker, %22Could not write data.%22, ex);%0A%09%09%09%7D%0A%09%09%09return new ResourceLocation(modid, name);%0A%09%09%7D).map(ResourceLocation::toString).collect(Collectors.toList());%0A%09%09%0A%09%09final JsonObject json = new JsonObject();%0A%09%09json.addProperty(%22replace%22, replace);%0A%09%09json.add(%22entries%22, GSON.toJsonTree(entries));%0A%09%09%0A%09%09try %7B%0A%09%09%09write(cache, json, path.resolve(%22data%22).resolve(%22forge%22).resolve(%22loot_modifiers%22).resolve(%22global_loot_modifiers.json%22));%0A%09%09%7D catch (final IOException ex) %7B%0A%09%09%09LOGGER.error(marker, %22Could not write data.%22, ex);%0A%09%09%7D%0A%09%7D%0A%09%0A%09protected void replacing() %7B%0A%09%09replace = true;%0A%09%7D%0A%09%0A%09protected abstract %3CT extends IGlobalLootModifier%3E void registerGlobalLootModifiers(TriConsumer%3CString, Supplier%3CGlobalLootModifierSerializer%3CT%3E%3E, T%3E consumer);%0A%09%0A%09@Override%0A%09public String getName() %7B%0A%09%09return %22Global-Loot-Modifiers%22;%0A%09%7D%0A%09%0A%7D%0A

Implement common global loot modifier provider