mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 16:54:22 +00:00
Automatic mod entity registration into the global entity list. This might break
entity code out there, sorry, but this way for most entities you no longer need to manage the global mod entity stuff at all. just remove it. FML will take care of the rest (note, worlds won't load the old entities)
This commit is contained in:
1 parent
ef01745e09
commit
c349d51923
2 files changed
+19
-1
No files matched your search
@@ -22,6 +22,7 @@ import com.google.common.collect.Maps;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
|
||||
public class EntityRegistry
|
||||
@@ -124,6 +125,17 @@ public class EntityRegistry
|
||||
{
|
||||
entityClassRegistrations.put(entityClass, er);
|
||||
entityNames.put(entityName, mc);
|
||||
if (!EntityList.field_75626_c.containsKey(entityClass))
|
||||
{
|
||||
String entityModName = String.format("%s.%s", mc.getModId(), entityName);
|
||||
EntityList.field_75626_c.put(entityClass, entityModName);
|
||||
EntityList.field_75625_b.put(entityModName, entityClass);
|
||||
FMLLog.finest("Automatically registered mod %s entity %s as %s", mc.getModId(), entityName, entityModName);
|
||||
}
|
||||
else
|
||||
{
|
||||
FMLLog.fine("Skipping automatic mod %s entity registration for already registered class %s", mc.getModId(), entityClass.getName());
|
||||
}
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
@@ -135,6 +147,11 @@ public class EntityRegistry
|
||||
|
||||
public static void registerGlobalEntityID(Class <? extends Entity > entityClass, String entityName, int id)
|
||||
{
|
||||
if (EntityList.field_75626_c.containsKey(entityClass))
|
||||
{
|
||||
FMLLog.warning("The mod %s tried to register the entity class %s which was already registered - if you wish to override default naming for FML mod entities, register it here first", Loader.instance().activeModContainer().getModId(), entityClass);
|
||||
return;
|
||||
}
|
||||
instance().validateAndClaimId(id);
|
||||
EntityList.func_75618_a(entityClass, entityName, id);
|
||||
}
|
||||
|
||||
+2
-1
@@ -4,9 +4,10 @@ public aji.a(Ljava/lang/Class;Ljava/lang/String;)V
|
||||
# EntityList addMappings
|
||||
public jr.a(Ljava/lang/Class;Ljava/lang/String;I)V
|
||||
public jr.a(Ljava/lang/Class;Ljava/lang/String;III)V
|
||||
# EntityList nameToClassMap and idToClassMap
|
||||
# EntityList nameToClassMap and idToClassMap and classToNameMap
|
||||
public jr.b
|
||||
public jr.d
|
||||
public jr.c
|
||||
# RenderEngine
|
||||
public avf.k # texturePack
|
||||
# RenderManager renderers
|
||||
|
||||
Reference in new issue
Block a user