More work, game loads and runs now.

Moved Registry events to directly AFTER PreInit instead of before.
This allows modders to register handlers for it without @EventBusSubscriber.
It also allows you to register custom things needed before the construction of blocks or items such as Fluids.
TODO: Move Fluids to a real registry.
@ObjectHolder can now be used on private fields.
Reworked FMLModIdMappingEvent to include data for all registries.
Tile Entities are now registrable.
This commit is contained in:
LexManos committed 2017-06-23 16:59:57 -05:00
1 parent a26d89c876
commit dee84dc1e4
21 files changed
+230 -278

No files matched your search

@@ -27,6 +27,7 @@ import java.util.Set;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.discovery.ASMDataTable;
import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData;
import net.minecraftforge.fml.common.registry.GameRegistry;
@@ -52,6 +53,11 @@ public enum ObjectHolderRegistry
Set<ASMData> allObjectHolders = table.getAll(GameRegistry.ObjectHolder.class.getName());
Map<String, String> classModIds = Maps.newHashMap();
Map<String, Class<?>> classCache = Maps.newHashMap();
for (ASMData data : table.getAll(Mod.class.getName()))
{
String modid = (String)data.getAnnotationInfo().get("modid");
classModIds.put(data.getClassName(), modid);
}
for (ASMData data : allObjectHolders)
{
String className = data.getClassName();
@@ -119,7 +125,7 @@ public enum ObjectHolderRegistry
}
try
{
Field f = clazz.getField(annotationTarget);
Field f = clazz.getDeclaredField(annotationTarget);
addHolderReference(new ObjectHolderRef(f, new ResourceLocation(value), extractFromValue));
}
catch (Exception ex)