mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-25 14:34:28 +00:00
41 lines
1.5 KiB
Diff
41 lines
1.5 KiB
Diff
--- ../src-base/minecraft/net/minecraft/entity/EntityList.java
|
|
+++ ../src-work/minecraft/net/minecraft/entity/EntityList.java
|
|
@@ -91,6 +91,7 @@
|
|
|
|
public static void addMapping(Class <? extends Entity > entityClass, String entityName, int id)
|
|
{
|
|
+ if (id < 0 || id > 255) throw new IllegalArgumentException("Attempted to register a entity with invalid ID: " + id + " Name: " + entityName + " Class: " + entityClass);
|
|
if (stringToClassMapping.containsKey(entityName))
|
|
{
|
|
throw new IllegalArgumentException("ID is already registered: " + entityName);
|
|
@@ -148,9 +149,10 @@
|
|
{
|
|
Entity entity = null;
|
|
|
|
+ Class <? extends Entity > oclass = null;
|
|
try
|
|
{
|
|
- Class <? extends Entity > oclass = (Class)stringToClassMapping.get(nbt.getString("id"));
|
|
+ oclass = stringToClassMapping.get(nbt.getString("id"));
|
|
|
|
if (oclass != null)
|
|
{
|
|
@@ -164,7 +166,17 @@
|
|
|
|
if (entity != null)
|
|
{
|
|
+ try
|
|
+ {
|
|
entity.readFromNBT(nbt);
|
|
+ }
|
|
+ catch (Exception e)
|
|
+ {
|
|
+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e,
|
|
+ "An Entity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author",
|
|
+ nbt.getString("id"), oclass.getName());
|
|
+ entity = null;
|
|
+ }
|
|
}
|
|
else
|
|
{
|