Fixed potential NPEs in Structure code caused by componenets not being able to load.

This commit is contained in:
Lex Manos 2015-02-05 17:03:43 -08:00
parent 9c50745bdb
commit 9704f25aa8

View file

@ -11,3 +11,13 @@
NBTTagCompound nbttagcompound = new NBTTagCompound(); NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.func_74778_a("id", MapGenStructureIO.func_143033_a(this)); nbttagcompound.func_74778_a("id", MapGenStructureIO.func_143033_a(this));
nbttagcompound.func_74768_a("ChunkX", p_143021_1_); nbttagcompound.func_74768_a("ChunkX", p_143021_1_);
@@ -97,7 +101,8 @@
for (int i = 0; i < nbttaglist.func_74745_c(); ++i)
{
- this.field_75075_a.add(MapGenStructureIO.func_143032_b(nbttaglist.func_150305_b(i), p_143020_1_));
+ StructureComponent tmp = MapGenStructureIO.func_143032_b(nbttaglist.func_150305_b(i), p_143020_1_);
+ if (tmp != null) this.field_75075_a.add(tmp); //Forge: Prevent NPEs further down the line when a component can't be loaded.
}
this.func_143017_b(p_143020_2_);