Global Loot Functions (#6401)

This commit is contained in:
Draco18s authored and GitHub committed 2020-02-26 22:13:36 -08:00
1 parent 2ce4f5ece5
commit 58e5f33fad
18 files changed
+643 -44

No files matched your search

@@ -63,6 +63,7 @@ import net.minecraft.world.gen.placement.Placement;
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.ModDimension;
import net.minecraftforge.common.loot.GlobalLootModifierSerializer;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.event.RegistryEvent.MissingMappings;
import net.minecraftforge.fml.LifecycleEventProvider;
@@ -141,6 +142,7 @@ public class GameData
// Custom forge registries
public static final ResourceLocation MODDIMENSIONS = new ResourceLocation("forge:moddimensions");
public static final ResourceLocation SERIALIZERS = new ResourceLocation("minecraft:dataserializers");
public static final ResourceLocation LOOT_MODIFIER_SERIALIZERS = new ResourceLocation("forge:loot_modifier_serializers");
private static final int MAX_VARINT = Integer.MAX_VALUE - 1; //We were told it is their intention to have everything in a reg be unlimited, so assume that until we find cases where it isnt.
@@ -207,6 +209,7 @@ public class GameData
// Custom forge registries
makeRegistry(MODDIMENSIONS, ModDimension.class ).disableSaving().create();
makeRegistry(SERIALIZERS, DataSerializerEntry.class, 256 /*vanilla space*/, MAX_VARINT).disableSaving().disableOverrides().addCallback(SerializerCallbacks.INSTANCE).create();
makeRegistry(LOOT_MODIFIER_SERIALIZERS, GlobalLootModifierSerializer.class).disableSaving().disableSync().create();
}
private static <T extends IForgeRegistryEntry<T>> RegistryBuilder<T> makeRegistry(ResourceLocation name, Class<T> type)