You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 28, 2020. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 28, 2020. It is now read-only.
I managed to get this library working with my worldgenerator but there are two things that bother me:
My fully explored source region from a Mincraft-1.6.2-Client has 4104KB but the generated Files always have 8200KB of filesize even if i did not change anything.
Regions generated with this library are playable in Minecraft but can not be rendered by my favorite maping tool Overviewer, (which is the main reason why i am here :) ) which is either a bug or i am not using the library as it was intended to.
This is how I produced the "not so good" regionfile:
I created a flatword in the regular 1.6.2 Minecraft-Client and used it as source(layer 1 bedrock, layer 2 grass): flatworld_master_r.0.0.mca.zip
I used the code you can see below to generate a new region: r.0.0.mca.zip
and just for your interest as it might be helpful to find the bug(if it is one): the erroroutput from Overviewer with some tileIDs that couldn't be found: nohup.out.txt.zip
The masterfile can be rendered but the generated one not.
As a footnote:
I really apreciate your work with this library, it is easy to use and saved me from being forced to create something similar on my own :)
The worlds i am creating are very huge (mostly 20kmx20km and bigger) and that is why it is essential for me to have regionfiles that are not bigger than necessary and a map to navigate fast on these worlds.
This is the code example which I used to generate the second file:
My fully explored source region from a Mincraft-1.6.2-Client has 4104KB but the generated Files always have 8200KB of filesize even if i did not change anything.
I can't test right now, but does this happen if you region.WriteChunk(x, y, region.ReadChunk(x, y))? Or with your example?
Regions generated with this library are playable in Minecraft but can not be rendered by my favorite maping tool Overviewer, (which is the main reason why i am here :) ) which is either a bug or i am not using the library as it was intended to.
Weird. Could you set your launcher to reopen when the game closes and see if there are any warnings or errors in the log?
I am still trying ti maintain this library, it's a bit behind in terms of the new entities and such but most things should work. I'll look into your issues when I have time, I can't really think why they would happen.
My fully explored source region from a Mincraft-1.6.2-Client has 4104KB but the generated Files always have 8200KB of filesize even if i did not change anything.
Actually another thing to note here is the javadoc on Region.WriteChunk:
Writes the given chunk to the region file in a lazy fashion. If the chunk exists in the region file and the given chunk can fit, it will be placed there and the sector size will be updated. Otherwise the chunk will be placed at the end of the region file without removing the old chunk, and the offset and sector size will be updated.
Short summary: I used the lib in the wrong way, now it works like a charm and both problems are solved :)
I forgot to mention that the target file in my first post does not exist. Reading your comments I reconsidered my code and came to the solution you can see below.
Now the filesize is always 4102KB and the map can be rendered by Overviewer without any error.
Thank you very much for your fast help :)
importjava.io.File;
importjava.io.IOException;
importjava.io.RandomAccessFile;
importjava.nio.channels.FileChannel;
importmcmodify.nbt.minecraft.Chunk;
importmcmodify.nbt.minecraft.IDs;
importmcmodify.nbt.minecraft.Region;
publicclassMinimalExample4
{
publicstaticvoidmain(String[] args)
{
try
{
//Region region = new Region(new File("flatworld_master_r.0.0.mca"));Stringfilename = "r.0.0.mca";
//===================================================//the missing line that solved both problemscopyFile("flatworld_master_r.0.0.mca",filename);
//===================================================Regionnewregion = newRegion(newFile(filename));
for (intx = 0; x < 32; x++)
{
for (inty = 0; y < 32; y++)
{
Chunkchunk = newregion.ReadChunk(x, y);
for (intk = 0; k < 16; k++)
{
for (intk2 = 0; k2 < 16; k2++)
{
chunk.BlockID(k, 0, k2, IDs.Bedrock);
chunk.BlockID(k, 1, k2, IDs.Grass);
}
}
newregion.WriteChunk(x, y, chunk);
}
}
}
catch (Exceptione)
{
e.printStackTrace();
}
}
publicstaticvoidcopyFile(StringsourceName, StringtargetName) throwsIOException
{
FilesourceFile = newFile(sourceName);
FiledestFile = newFile(targetName);
if (!destFile.exists())
{
destFile.createNewFile();
}
FileChannelsource = null;
FileChanneldestination = null;
try
{
source = newRandomAccessFile(sourceFile, "rw").getChannel();
destination = newRandomAccessFile(destFile, "rw").getChannel();
longposition = 0;
longcount = source.size();
source.transferTo(position, count, destination);
}
finally
{
if (source != null)
{
source.close();
}
if (destination != null)
{
destination.close();
}
}
}
}
Activity
LB-- commentedon Aug 21, 2013
I can't test right now, but does this happen if you
region.WriteChunk(x, y, region.ReadChunk(x, y))? Or with your example?Weird. Could you set your launcher to reopen when the game closes and see if there are any warnings or errors in the log?
I am still trying ti maintain this library, it's a bit behind in terms of the new entities and such but most things should work. I'll look into your issues when I have time, I can't really think why they would happen.
LB-- commentedon Aug 21, 2013
Actually another thing to note here is the javadoc on Region.WriteChunk:
Not sure if this comes into play here or not.
DonRudiX commentedon Aug 23, 2013
Short summary: I used the lib in the wrong way, now it works like a charm and both problems are solved :)
I forgot to mention that the target file in my first post does not exist. Reading your comments I reconsidered my code and came to the solution you can see below.
Now the filesize is always 4102KB and the map can be rendered by Overviewer without any error.
Thank you very much for your fast help :)
LB-- commentedon Aug 23, 2013
Ah, I don't remember how well creating new regions from scratch works. I'll have to look into that. Glad you got it to work for you!