Throw more descriptive errors when mods attempt to register invalid global entity IDs.
This commit is contained in:
parent
b3a1548cfa
commit
64263a9f8e
2 changed files with 23 additions and 1 deletions
|
@ -32,7 +32,19 @@
|
|||
}
|
||||
|
||||
public void func_147279_a(S0BPacketAnimation p_147279_1_)
|
||||
@@ -1127,6 +1134,10 @@
|
||||
@@ -735,6 +742,11 @@
|
||||
float f = (float)(p_147281_1_.func_149028_l() * 360) / 256.0F;
|
||||
float f1 = (float)(p_147281_1_.func_149030_m() * 360) / 256.0F;
|
||||
EntityLivingBase entitylivingbase = (EntityLivingBase)EntityList.func_75616_a(p_147281_1_.func_149025_e(), this.field_147299_f.field_71441_e);
|
||||
+ if (entitylivingbase == null)
|
||||
+ {
|
||||
+ cpw.mods.fml.common.FMLLog.info("Server attempted to spawn an unknown entity using ID: {0} at ({1}, {2}, {3}) Skipping!", p_147281_1_.func_149025_e(), d0, d1, d2);
|
||||
+ return;
|
||||
+ }
|
||||
entitylivingbase.field_70118_ct = p_147281_1_.func_149023_f();
|
||||
entitylivingbase.field_70117_cu = p_147281_1_.func_149034_g();
|
||||
entitylivingbase.field_70116_cv = p_147281_1_.func_149029_h();
|
||||
@@ -1127,6 +1139,10 @@
|
||||
{
|
||||
tileentity.func_145839_a(p_147273_1_.func_148857_g());
|
||||
}
|
||||
|
|
10
patches/minecraft/net/minecraft/entity/EntityList.java.patch
Normal file
10
patches/minecraft/net/minecraft/entity/EntityList.java.patch
Normal file
|
@ -0,0 +1,10 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/EntityList.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/EntityList.java
|
||||
@@ -84,6 +84,7 @@
|
||||
|
||||
public static void func_75618_a(Class p_75618_0_, String p_75618_1_, int p_75618_2_)
|
||||
{
|
||||
+ if (p_75618_2_ < 0 || p_75618_2_ > 255) throw new IllegalArgumentException("Attempted to register a entity with invalid ID: " + p_75618_2_ + " Name: " + p_75618_1_ + " Class: " + p_75618_0_);
|
||||
if (field_75625_b.containsKey(p_75618_1_))
|
||||
{
|
||||
throw new IllegalArgumentException("ID is already registered: " + p_75618_1_);
|
Loading…
Reference in a new issue