 +        {
 +            dest.add(par4TileEntity);
 +        }
-+        
-+        Chunk var5 = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4);
  
 -                if (var5 != null)
 -                {
 -                    var5.setChunkBlockTileEntity(par1 & 15, par2, par3 & 15, par4TileEntity);
 -                }
 -            }
++        Chunk var5 = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4);
++
 +        if (var5 != null)
 +        {
 +            var5.setChunkBlockTileEntity(par1 & 15, par2, par3 & 15, par4TileEntity);
          }
      }
  
-@@ -2219,27 +2242,10 @@
+@@ -2219,27 +2243,10 @@
       */
      public void removeBlockTileEntity(int par1, int par2, int par3)
      {
 -        TileEntity var4 = this.getBlockTileEntity(par1, par2, par3);
 -
 -        if (var4 != null && this.scanningTileEntities)
-+        Chunk var5 = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4);
-+        if (var5 != null)
-         {
+-        {
 -            var4.invalidate();
 -            this.addedTileEntityList.remove(var4);
 -        }
 -        else
--        {
++        Chunk var5 = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4);
++        if (var5 != null)
+         {
 -            if (var4 != null)
 -            {
 -                this.addedTileEntityList.remove(var4);

                     }
                 }
             }
@@ -1614,6 +1628,10 @@
 
         if (!this.entityRemoval.isEmpty())
         {

     }
 
     /**
@@ -363,7 +375,8 @@
     public boolean blockHasTileEntity(int par1, int par2, int par3)
     {
         int var4 = this.getBlockId(par1, par2, par3);
-        return Block.blocksList[var4] != null && Block.blocksList[var4].hasTileEntity();
+        int md = this.getBlockMetadata(par1, par2, par3);
+        return Block.blocksList[var4] != null && Block.blocksList[var4].hasTileEntity(md);
     }
 
     /**
@@ -956,7 +969,9 @@
                 int var12 = this.getBlockMetadata(var8, var9, var10);
                 Block var13 = Block.blocksList[var11];
 
-                if ((!par4 || var13 == null || var13.getCollisionBoundingBoxFromPool(this, var8, var9, var10) != null) && var11 > 0 && var13.canCollideCheck(var12, par3))
+                if (var13 != null &&  //BugFix NPE on missconfigured block ids.
+                   (!par4 || var13 == null || var13.getCollisionBoundingBoxFromPool(this, var8, var9, var10) != null) &&
+                   var11 > 0 && var13.canCollideCheck(var12, par3))
                 {
                     MovingObjectPosition var14 = var13.collisionRayTrace(this, var8, var9, var10, par1Vec3D, par2Vec3D);
 
@@ -1604,7 +1619,7 @@
 
                     if (var7 != null)
                     {
