public Chunk func_75815_a(World p_75815_1_, int p_75815_2_, int p_75815_3_) throws IOException { NBTTagCompound var4 = null; ChunkCoordIntPair var5 = new ChunkCoordIntPair(p_75815_2_, p_75815_3_); Object var6 = this.field_75827_c; synchronized(this.field_75827_c) { if(this.field_75826_b.contains(var5)) { for(int var7 = 0; var7 < this.field_75828_a.size(); ++var7) { if(((AnvilChunkLoaderPending)this.field_75828_a.get(var7)).field_76548_a.equals(var5)) { var4 = ((AnvilChunkLoaderPending)this.field_75828_a.get(var7)).field_76547_b; break; } } } } if(var4 == null) { DataInputStream var10 = RegionFileCache.func_76549_c(this.field_75825_d, p_75815_2_, p_75815_3_); if(var10 == null) { return null; } var4 = CompressedStreamTools.func_74794_a(var10); } return this.func_75822_a(p_75815_1_, p_75815_2_, p_75815_3_, var4); }
/** Load the previously saved TileEntities and add them to the Chunk **/ public static void importTileEntities( Chunk chunk ) { File chunkSaveLocation = (File) Reflexion.stealField( AnvilChunkLoader.class, File.class ).get(chunkLoader); DataInputStream dis = RegionFileCache.getChunkInputStream( chunkSaveLocation, chunk.xPosition, chunk.zPosition ); try { NBTTagCompound chunkNBT = CompressedStreamTools.read( dis ); NBTTagCompound levelNBT = chunkNBT.getCompoundTag( "Level" ); // The official code checks if the chunk is in the right location. Should I too?. NBTTagList tileEntitiesNBT = levelNBT.getTagList( "TileEntities" ); for( int i = 0; i < tileEntitiesNBT.tagCount(); i++ ) { NBTTagCompound tileEntityNBT = (NBTTagCompound) tileEntitiesNBT.tagAt( i ); TileEntity te = TileEntity.createAndLoadEntity( tileEntityNBT ); String entityType = getTEName(te); if(( isImportableTileEntity( te ) )) { if( ! newTileEntities.contains( new ChunkPosition( te.xCoord, te.yCoord, te.zCoord ) ) ) { wc.setBlockTileEntity( te.xCoord, te.yCoord, te.zCoord, te ); chatDebug("Loaded TE: " + entityType + " at " + te.xCoord + " " + te.yCoord + " " + te.zCoord ); } else { chatDebug( "Dropping old TE: " + entityType + " at " + te.xCoord + " " + te.yCoord + " " + te.zCoord ); } } else { chatDebug( "TE is not importable: " + entityType + " at " + te.xCoord + " " + te.yCoord + " " + te.zCoord ); } } } catch ( Exception e ) { } // Couldn't load the old chunk. Nothing unusual. Happens with every not downloaded chunk. }
public void func_75759_a() { try { ThreadedFileIOBase.field_75741_a.func_75734_a(); } catch (InterruptedException var2) { var2.printStackTrace(); } RegionFileCache.func_76551_a(); }
private static boolean chunksExist(MinecraftServer server, int x, int z, int dimensionID) { WorldServer world = DimensionManager.getWorld(dimensionID); ChunkProviderServer chunkProvider = server.worldServerForDimension(dimensionID).getChunkProvider(); return chunkProvider.chunkExists(x, z) || RegionFileCache.createOrLoadRegionFile(world.getChunkSaveLocation(), x, z).chunkExists(x & 0x1F, z & 0x1F); }
private void func_75821_a(AnvilChunkLoaderPending p_75821_1_) throws IOException { DataOutputStream var2 = RegionFileCache.func_76552_d(this.field_75825_d, p_75821_1_.field_76548_a.field_77276_a, p_75821_1_.field_76548_a.field_77275_b); CompressedStreamTools.func_74800_a(p_75821_1_.field_76547_b, var2); var2.close(); }
public void func_75800_d() { RegionFileCache.func_76551_a(); }
private static boolean chunksExist(ChunkProviderServer cps, int x, int z, int dimensionID) { WorldServer world = null; world = DimensionManager.getWorld(dimensionID); return RegionFileCache.createOrLoadRegionFile(world.getChunkSaveLocation(), x, z).chunkExists(x & 0x1F, z & 0x1F); }