          if (!p_75822_4_.func_150297_b("Level", 10))
          {
              field_151505_a.error("Chunk file at " + p_75822_2_ + "," + p_75822_3_ + " is missing level data, skipping");
-@@ -100,10 +147,29 @@
+@@ -100,10 +147,27 @@
                  field_151505_a.error("Chunk file at " + p_75822_2_ + "," + p_75822_3_ + " is in the wrong location; relocating. (Expected " + p_75822_2_ + ", " + p_75822_3_ + ", got " + chunk.field_76635_g + ", " + chunk.field_76647_h + ")");
                  p_75822_4_.func_74768_a("xPos", p_75822_2_);
                  p_75822_4_.func_74768_a("zPos", p_75822_3_);
 +
 +                // Have to move tile entities since we don't load them at this stage
-+                NBTTagList tileEntities = p_75822_4_.func_74775_l("Level").func_150295_c("TileEntities", 10);
++                NBTTagList _tileEntities = p_75822_4_.func_74775_l("Level").func_150295_c("TileEntities", 10);
 +
-+                if (tileEntities != null)
++                if (_tileEntities != null)
 +                {
-+                    for (int te = 0; te < tileEntities.func_74745_c(); te++)
++                    for (int te = 0; te < _tileEntities.func_74745_c(); te++)
 +                    {
-+                        NBTTagCompound tileEntity = (NBTTagCompound) tileEntities.func_150305_b(te);
-+                        int x = tileEntity.func_74762_e("x") - chunk.field_76635_g * 16;
-+                        int z = tileEntity.func_74762_e("z") - chunk.field_76647_h * 16;
-+                        tileEntity.func_74768_a("x", p_75822_2_ * 16 + x);
-+                        tileEntity.func_74768_a("z", p_75822_3_ * 16 + z);
++                        NBTTagCompound _nbt = (NBTTagCompound) _tileEntities.func_150305_b(te);
++                        _nbt.func_74768_a("x", p_75822_2_ * 16 + (_nbt.func_74762_e("x") - chunk.field_76635_g * 16));
++                        _nbt.func_74768_a("z", p_75822_3_ * 16 + (_nbt.func_74762_e("z") - chunk.field_76647_h * 16));
 +                    }
 +                }
                  chunk = this.func_75823_a(p_75822_1_, p_75822_4_.func_74775_l("Level"));

         NBTTagList nbttaglist1 = p_75823_2_.func_150295_c("Entities", 10);
 
         if (nbttaglist1 != null)
@@ -475,8 +548,6 @@
                 }
             }
         }

             this.func_75824_a(p_75816_2_.func_76632_l(), nbttagcompound);
         }
         catch (Exception exception)
@@ -404,6 +469,12 @@
             chunk.func_76616_a(p_75823_2_.func_74770_j("Biomes"));
         }
 
