mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-16 10:34:49 +00:00
Fix a couple of modloader mods. Thanks!
This commit is contained in:
1 parent
483667c919
commit
d6326deeb0
2 files changed
+13
-6
No files matched your search
@@ -9,12 +9,12 @@ public class FMLLog
|
|||||||
|
|
||||||
public static void log(Level level, String format, Object... data)
|
public static void log(Level level, String format, Object... data)
|
||||||
{
|
{
|
||||||
coreLog.log(level, String.format(format, data));
|
coreLog.log(level, format, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void log(Level level, Throwable ex, String format, Object... data)
|
public static void log(Level level, Throwable ex, String format, Object... data)
|
||||||
{
|
{
|
||||||
coreLog.log(level, ex, String.format(format, data));
|
coreLog.log(level, ex, format, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void severe(String format, Object... data)
|
public static void severe(String format, Object... data)
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public class EntityRegistry
|
|||||||
private EntityRegistry()
|
private EntityRegistry()
|
||||||
{
|
{
|
||||||
availableIndicies = new BitSet(256);
|
availableIndicies = new BitSet(256);
|
||||||
availableIndicies.set(0,255);
|
availableIndicies.set(1,255);
|
||||||
for (Object id : EntityList.field_75623_d.keySet())
|
for (Object id : EntityList.field_75623_d.keySet())
|
||||||
{
|
{
|
||||||
availableIndicies.clear((Integer)id);
|
availableIndicies.clear((Integer)id);
|
||||||
@@ -129,6 +129,7 @@ public class EntityRegistry
|
|||||||
{
|
{
|
||||||
instance().doModEntityRegistration(entityClass, entityName, id, mod, trackingRange, updateFrequency, sendsVelocityUpdates);
|
instance().doModEntityRegistration(entityClass, entityName, id, mod, trackingRange, updateFrequency, sendsVelocityUpdates);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doModEntityRegistration(Class<? extends Entity> entityClass, String entityName, int id, Object mod, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates)
|
private void doModEntityRegistration(Class<? extends Entity> entityClass, String entityName, int id, Object mod, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates)
|
||||||
{
|
{
|
||||||
ModContainer mc = FMLCommonHandler.instance().findContainerFor(mod);
|
ModContainer mc = FMLCommonHandler.instance().findContainerFor(mod);
|
||||||
@@ -164,17 +165,23 @@ public class EntityRegistry
|
|||||||
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);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
instance().validateAndClaimId(id);
|
id = instance().validateAndClaimId(id);
|
||||||
EntityList.func_75618_a(entityClass, entityName, id);
|
EntityList.func_75618_a(entityClass, entityName, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateAndClaimId(int id)
|
private int validateAndClaimId(int id)
|
||||||
{
|
{
|
||||||
|
// workaround for broken ML
|
||||||
|
if (id < 0)
|
||||||
|
{
|
||||||
|
id += 3000;
|
||||||
|
}
|
||||||
if (!availableIndicies.get(id))
|
if (!availableIndicies.get(id))
|
||||||
{
|
{
|
||||||
throw new RuntimeException(String.format("Unable to claim entity id %d", id));
|
FMLLog.severe("The mod %s has attempted to register an entity ID %d which is already reserved. This could cause severe problems", Loader.instance().activeModContainer().getModId(), id);
|
||||||
}
|
}
|
||||||
availableIndicies.clear(id);
|
availableIndicies.clear(id);
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerGlobalEntityID(Class <? extends Entity > entityClass, String entityName, int id, int backgroundEggColour, int foregroundEggColour)
|
public static void registerGlobalEntityID(Class <? extends Entity > entityClass, String entityName, int id, int backgroundEggColour, int foregroundEggColour)
|
||||||
|
|||||||
Reference in new issue
Block a user