private TileEntity fixTileEntity(int x, int y, int z, int type, TileEntity found) {
    this.getServer()
        .getLogger()
        .severe(
            "Block at "
                + x
                + ","
                + y
                + ","
                + z
                + " is "
                + org.bukkit.Material.getMaterial(type).toString()
                + " but has "
                + found
                + ". "
                + "Bukkit will attempt to fix this, but there may be additional damage that we cannot recover.");

    if (Block.byId[type] instanceof BlockContainer) {
      TileEntity replacement = ((BlockContainer) Block.byId[type]).b(this);
      replacement.world = this;
      this.setTileEntity(x, y, z, replacement);
      return replacement;
    } else {
      this.getServer()
          .getLogger()
          .severe("Don't know how to fix for this type... Can't do anything! :(");
      return found;
    }
  }