Java 类net.minecraft.world.chunk.storage.RegionFile 实例源码

项目:Geographicraft    文件:ChunkLister.java   
ArrayList<PlaneLocation> savedChunks() {
       ArrayList<PlaneLocation> result = new ArrayList<PlaneLocation>();
       RegionFile regionFile = new RegionFile(filePath);
       for (int x = 0; x < 32; x++){
            for (int z = 0; z < 32; z++){
                    if(regionFile.isChunkSaved(x, z)){
                            int chunkX = (regionX * 32 + x);
                            int chunkZ = (regionZ * 32 + z);
                            result.add(new PlaneLocation(chunkX,chunkZ));
                    }
            }

       }
    try {
        regionFile.close();
    } catch (IOException ex) {
        Logger.getLogger(ChunkLister.class.getName()).log(Level.SEVERE, null, ex);
        throw new RuntimeException(ex);
    }
    return result;
}
项目:RuneCraftery    文件:RegionFileCache.java   
public static synchronized RegionFile func_76550_a(File p_76550_0_, int p_76550_1_, int p_76550_2_) {
   File var3 = new File(p_76550_0_, "region");
   File var4 = new File(var3, "r." + (p_76550_1_ >> 5) + "." + (p_76550_2_ >> 5) + ".mca");
   RegionFile var5 = (RegionFile)field_76553_a.get(var4);
   if(var5 != null) {
      return var5;
   } else {
      if(!var3.exists()) {
         var3.mkdirs();
      }

      if(field_76553_a.size() >= 256) {
         func_76551_a();
      }

      RegionFile var6 = new RegionFile(var4);
      field_76553_a.put(var4, var6);
      return var6;
   }
}
项目:RuneCraftery    文件:RegionFileCache.java   
public static synchronized void func_76551_a() {
   Iterator var0 = field_76553_a.values().iterator();

   while(var0.hasNext()) {
      RegionFile var1 = (RegionFile)var0.next();

      try {
         if(var1 != null) {
            var1.func_76708_c();
         }
      } catch (IOException var3) {
         var3.printStackTrace();
      }
   }

   field_76553_a.clear();
}
项目:RuneCraftery    文件:RegionFileCache.java   
public static DataInputStream func_76549_c(File p_76549_0_, int p_76549_1_, int p_76549_2_) {
   RegionFile var3 = func_76550_a(p_76549_0_, p_76549_1_, p_76549_2_);
   return var3.func_76704_a(p_76549_1_ & 31, p_76549_2_ & 31);
}
项目:RuneCraftery    文件:RegionFileCache.java   
public static DataOutputStream func_76552_d(File p_76552_0_, int p_76552_1_, int p_76552_2_) {
   RegionFile var3 = func_76550_a(p_76552_0_, p_76552_1_, p_76552_2_);
   return var3.func_76710_b(p_76552_1_ & 31, p_76552_2_ & 31);
}
项目:RuneCraftery    文件:AnvilSaveConverter.java   
private void func_75811_a(File p_75811_1_, File p_75811_2_, WorldChunkManager p_75811_3_, int p_75811_4_, int p_75811_5_, IProgressUpdate p_75811_6_) {
   try {
      String var7 = p_75811_2_.getName();
      RegionFile var8 = new RegionFile(p_75811_2_);
      RegionFile var9 = new RegionFile(new File(p_75811_1_, var7.substring(0, var7.length() - ".mcr".length()) + ".mca"));

      for(int var10 = 0; var10 < 32; ++var10) {
         int var11;
         for(var11 = 0; var11 < 32; ++var11) {
            if(var8.func_76709_c(var10, var11) && !var9.func_76709_c(var10, var11)) {
               DataInputStream var12 = var8.func_76704_a(var10, var11);
               if(var12 == null) {
                  MinecraftServer.func_71276_C().func_98033_al().func_98236_b("Failed to fetch input stream");
               } else {
                  NBTTagCompound var13 = CompressedStreamTools.func_74794_a(var12);
                  var12.close();
                  NBTTagCompound var14 = var13.func_74775_l("Level");
                  AnvilConverterData var15 = ChunkLoader.func_76691_a(var14);
                  NBTTagCompound var16 = new NBTTagCompound();
                  NBTTagCompound var17 = new NBTTagCompound();
                  var16.func_74782_a("Level", var17);
                  ChunkLoader.func_76690_a(var15, var17, p_75811_3_);
                  DataOutputStream var18 = var9.func_76710_b(var10, var11);
                  CompressedStreamTools.func_74800_a(var16, var18);
                  var18.close();
               }
            }
         }

         var11 = (int)Math.round(100.0D * (double)(p_75811_4_ * 1024) / (double)(p_75811_5_ * 1024));
         int var20 = (int)Math.round(100.0D * (double)((var10 + 1) * 32 + p_75811_4_ * 1024) / (double)(p_75811_5_ * 1024));
         if(var20 > var11) {
            p_75811_6_.func_73718_a(var20);
         }
      }

      var8.func_76708_c();
      var9.func_76708_c();
   } catch (IOException var19) {
      var19.printStackTrace();
   }

}
项目:RuneCraftery    文件:RegionFileChunkBuffer.java   
public RegionFileChunkBuffer(RegionFile p_i2000_1_, int p_i2000_2_, int p_i2000_3_) {
   super(8096);
   this.field_76724_a = p_i2000_1_;
   this.field_76722_b = p_i2000_2_;
   this.field_76723_c = p_i2000_3_;
}