  
          if (i < 0)
          {
-@@ -1068,8 +1169,8 @@
+@@ -1068,8 +1160,8 @@
       */
      public void getEntitiesOfTypeWithinAAAB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, List par3List, IEntitySelector par4IEntitySelector)
      {

                 {
                     TileEntity tileentity = this.getChunkBlockTileEntity(par1, par2, par3);
 
@@ -743,7 +837,7 @@
      */
     public int getSavedLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4)
     {
-        ExtendedBlockStorage extendedblockstorage = this.storageArrays[par3 >> 4];
+        ExtendedBlockStorage extendedblockstorage = (par3 >> 4 >= storageArrays.length || par3 >> 4 < 0 ? null : storageArrays[par3 >> 4]);
         return extendedblockstorage == null ? (this.canBlockSeeTheSky(par2, par3, par4) ? par1EnumSkyBlock.defaultLightValue : 0) : (par1EnumSkyBlock == EnumSkyBlock.Sky ? (this.worldObj.provider.hasNoSky ? 0 : extendedblockstorage.getExtSkylightValue(par2, par3 & 15, par4)) : (par1EnumSkyBlock == EnumSkyBlock.Block ? extendedblockstorage.getExtBlocklightValue(par2, par3 & 15, par4) : par1EnumSkyBlock.defaultLightValue));
     }
 
@@ -753,6 +847,11 @@
      */
     public void setLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4, int par5)
     {
+        if (par3 >> 4 >= storageArrays.length || par3 >> 4 < 0)
+        {
+            return;
+        }
+
         ExtendedBlockStorage extendedblockstorage = this.storageArrays[par3 >> 4];
 
         if (extendedblockstorage == null)
@@ -781,7 +880,7 @@
      */
     public int getBlockLightValue(int par1, int par2, int par3, int par4)
     {
-        ExtendedBlockStorage extendedblockstorage = this.storageArrays[par2 >> 4];
+        ExtendedBlockStorage extendedblockstorage = (par2 >> 4 >= storageArrays.length || par2 >> 4 < 0 ? null : storageArrays[par2 >> 4]);
 
         if (extendedblockstorage == null)
         {
@@ -834,7 +933,7 @@
         {
             k = this.entityLists.length - 1;
         }
-
+        MinecraftForge.EVENT_BUS.post(new EntityEvent.EnteringChunk(par1Entity, this.xPosition, this.zPosition, par1Entity.chunkCoordX, par1Entity.chunkCoordZ));
         par1Entity.addedToChunk = true;
         par1Entity.chunkCoordX = this.xPosition;
         par1Entity.chunkCoordY = k;
@@ -884,33 +983,32 @@
         ChunkPosition chunkposition = new ChunkPosition(par1, par2, par3);
         TileEntity tileentity = (TileEntity)this.chunkTileEntityMap.get(chunkposition);
 

         }
     }
 
@@ -1466,4 +1581,18 @@
             }
         }
     }
