forked from mirrors/NBTExplorer
Chunk coordinates were being aliased during chunk generation, causing Minecraft to hang. Also fixed player object creation.
This commit is contained in:
parent
8cb719f200
commit
6f78009c0e
5 changed files with 29 additions and 8 deletions
|
@ -13,10 +13,10 @@ namespace FlatMap
|
|||
static void Main (string[] args)
|
||||
{
|
||||
string dest = "F:\\Minecraft\\test";
|
||||
int xmin = -10;
|
||||
int xmax = 10;
|
||||
int zmin = -10;
|
||||
int zmaz = 10;
|
||||
int xmin = -20;
|
||||
int xmax = 20;
|
||||
int zmin = -20;
|
||||
int zmaz = 20;
|
||||
|
||||
// This will instantly create any necessary directory structure
|
||||
BetaWorld world = BetaWorld.Create(dest);
|
||||
|
@ -24,6 +24,7 @@ namespace FlatMap
|
|||
|
||||
// We can set different world parameters
|
||||
world.Level.LevelName = "Flatlands";
|
||||
world.Level.SetDefaultPlayer();
|
||||
|
||||
// We'll create chunks at chunk coordinates xmin,zmin to xmax,zmax
|
||||
for (int xi = xmin; xi < xmax; xi++) {
|
||||
|
@ -33,6 +34,10 @@ namespace FlatMap
|
|||
// written to disk)
|
||||
ChunkRef chunk = cm.CreateChunk(xi, zi);
|
||||
|
||||
// This will suppress generating caves, ores, and all those
|
||||
// other goodies.
|
||||
chunk.IsTerrainPopulated = true;
|
||||
|
||||
// Auto light recalculation is horrifically bad for creating
|
||||
// chunks from scratch, because we're placing thousands
|
||||
// of blocks. Turn it off.
|
||||
|
|
|
@ -106,9 +106,9 @@ namespace Substrate
|
|||
level.Add("HeightMap", _heightMap);
|
||||
level.Add("Entities", _entities);
|
||||
level.Add("TileEntities", _tileEntities);
|
||||
level.Add("LastUpdate", new TagLong());
|
||||
level.Add("xPos", new TagInt());
|
||||
level.Add("zPos", new TagInt());
|
||||
level.Add("LastUpdate", new TagLong(Timestamp()));
|
||||
level.Add("xPos", new TagInt(_cx));
|
||||
level.Add("zPos", new TagInt(_cz));
|
||||
level.Add("TerrainPopulated", new TagByte());
|
||||
|
||||
_tree = new NBT_Tree();
|
||||
|
@ -799,5 +799,11 @@ namespace Substrate
|
|||
|
||||
return Math.Max(light, info.Luminance);
|
||||
}
|
||||
|
||||
private int Timestamp ()
|
||||
{
|
||||
DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, 0);
|
||||
return (int)((DateTime.UtcNow - epoch).Ticks / (10000L * 1000L));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,6 +97,9 @@ namespace Substrate
|
|||
|
||||
public UntypedEntity ()
|
||||
{
|
||||
_pos = new Vector3();
|
||||
_motion = new Vector3();
|
||||
_rotation = new Orientation();
|
||||
}
|
||||
|
||||
public UntypedEntity (UntypedEntity e)
|
||||
|
|
|
@ -85,6 +85,10 @@ namespace Substrate
|
|||
_dimension = 0;
|
||||
_sleeping = 0;
|
||||
_sleepTimer = 0;
|
||||
|
||||
Air = 300;
|
||||
//Health = 20;
|
||||
Fire = -20;
|
||||
}
|
||||
|
||||
public Player (Player p)
|
||||
|
|
|
@ -264,7 +264,10 @@ namespace Substrate
|
|||
|
||||
DeleteChunk(lcx, lcz);
|
||||
|
||||
Chunk c = new Chunk(lcx, lcz);
|
||||
int cx = lcx + _rx * ChunkManager.REGION_XLEN;
|
||||
int cz = lcz + _rz * ChunkManager.REGION_ZLEN;
|
||||
|
||||
Chunk c = new Chunk(cx, cz);
|
||||
c.Save(GetChunkOutStream(lcx, lcz));
|
||||
|
||||
ChunkRef cr = new ChunkRef(this, cache, lcx, lcz);
|
||||
|
|
Loading…
Reference in a new issue