Search in sources :

Example 1 with RegionFile

use of net.minecraft.world.chunk.storage.RegionFile in project BluePower by Qmunity.

the class WorldConverter method convertRegion.

private void convertRegion(File file) {
    RegionFile reg = new RegionFile(file);
    for (int x = 0; x < 32; x++) {
        for (int z = 0; z < 32; z++) {
            NBTTagCompound chunk = getChunk(reg, x, z);
            if (chunk == null)
                continue;
            NBTTagList tileEntities = chunk.getTagList("TileEntities", new NBTTagCompound().getId());
            boolean changed = false;
            for (int i = 0; i < tileEntities.tagCount(); i++) {
                NBTTagCompound te = tileEntities.getCompoundTagAt(i);
                if (te.getString("id").equals("savedMultipart"))
                    changed |= convertTile(te);
            }
            if (changed)
                saveChunk(reg, x, z, chunk);
        }
    }
    try {
        reg.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) RegionFile(net.minecraft.world.chunk.storage.RegionFile) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 NBTTagList (net.minecraft.nbt.NBTTagList)1 RegionFile (net.minecraft.world.chunk.storage.RegionFile)1