public void importOldChunkTileEntities() { File file = wc.downloadSaveHandler.getSaveDirectory(); if (wc.worldProvider instanceof WorldProviderHell) { file = new File(file, "DIM-1"); file.mkdirs(); } java.io.DataInputStream datainputstream = RegionFileCache.getChunkInputStream(file, xPosition, zPosition); NBTTagCompound nbttagcompound; if (datainputstream != null) { try { nbttagcompound = CompressedStreamTools.func_1141_a(datainputstream); } catch (IOException e) { return; } } else return; if (!nbttagcompound.hasKey("Level")) return; NBTTagList nbttaglist1 = nbttagcompound.getCompoundTag("Level").getTagList("TileEntities"); if (nbttaglist1 != null) { for (int l = 0; l < nbttaglist1.tagCount(); l++) { NBTTagCompound nbttagcompound2 = (NBTTagCompound) nbttaglist1.tagAt(l); TileEntity te = TileEntity.createAndLoadEntity(nbttagcompound2); if (te != null) { ChunkPosition cp = new ChunkPosition(te.xCoord & 0xf, te.yCoord, te.zCoord & 0xf); newChunkTileEntityMap.put(cp, te); } } } }
private static boolean isChunkSavedPopulated(World world, int chunkX, int chunkZ) { File saveFolder = COWorldConfig.getWorldConfig(world).dimensionDir; DataInputStream stream = RegionFileCache.getChunkInputStream(saveFolder, chunkX, chunkZ); if (stream != null) { try { NBTTagCompound ex = CompressedStreamTools.read(stream); if (ex.hasKey("Level") && ex.getCompoundTag("Level").getBoolean("TerrainPopulated")) { return true; } } catch (IOException var6) {; } } return false; }