Skip to content

Example doesn't compile #44

@hypehuman

Description

@hypehuman

I tried running the example code on the Introduction page of the wiki, but it doesn't compile against the latest version of the source code. I tried changing it to this:

public static void Replace(string pathToWorld, int oldid, int newid)
{
    NbtWorld world = BetaWorld.Open(pathToWorld);
    var chunkManager = world.GetChunkManager();
    System.Diagnostics.Debug.WriteLine("Num chunks: " + chunkManager.Count());
    foreach (ChunkRef chunk in chunkManager)
    {
        // Process Chunk
        for (int y = 0; y <= 127; y++)
        {
            for (int x = 0; x <= 15; x++)
            {
                for (int z = 0; z <= 15; z++)
                {
                    // Attempt to replace block
                    int oldBlock = chunk.Blocks.GetID(x, y, z);
                    if (oldBlock == oldid)
                    {
                        chunk.Blocks.SetID(x, y, z, newid);
                        chunk.Blocks.SetData(x, y, z, 0);
                        // TileEntity consistency is implicitly maintained
                    }
                }
            }
        }

        // Save after each chunk so we can release unneeded chunks back to the system
        chunkManager.Save();
    }
}

But there are 0 chunks in the ChunkManager when I run it on "Substrate\Substrate.Tests\Data\1_9_2-debug".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions