--- ../src_base/common/net/minecraft/src/ChunkCache.java
+++ ../src_work/common/net/minecraft/src/ChunkCache.java
@@ -91,7 +91,15 @@
     {
         int var4 = (par1 >> 4) - this.chunkX;
         int var5 = (par3 >> 4) - this.chunkZ;
-        return this.chunkArray[var4][var5].getChunkBlockTileEntity(par1 & 15, par2, par3 & 15);
+        if (var4 >= 0 && var4 < this.chunkArray.length && var5 >= 0 && var5 < this.chunkArray[var4].length)
+        {
+            Chunk var6 = this.chunkArray[var4][var5];
+            return var6 == null ? null : var6.getChunkBlockTileEntity(par1 & 15, par2, par3 & 15);
+        }
+        else
+        {
+            return null;
+        }
     }
 
     @SideOnly(Side.CLIENT)
@@ -239,7 +247,12 @@
         {
             int var4 = (par1 >> 4) - this.chunkX;
             int var5 = (par3 >> 4) - this.chunkZ;
-            return this.chunkArray[var4][var5].getBlockMetadata(par1 & 15, par2, par3 & 15);
+            if (var4 >= 0 && var4 < this.chunkArray.length && var5 >= 0 && var5 < this.chunkArray[var4].length)
+            {
+                Chunk var6 = this.chunkArray[var4][var5];
+                return var6 == null ? 0 : var6.getBlockMetadata(par1 & 15, par2, par3 & 15);
+            }
+            return 0;
         }
     }
 

Fix bounds checking on chunkcache. Should fix a bunch of rp2 and maybe other extended tile entity code
Fix bounds checking on chunkcache. Should fix a bunch of rp2 and maybe other extended tile entity code
