Skip to content

Can't even open world. #38

@ehgoodenough

Description

@ehgoodenough

Set Up

I'm having issues even opening a world in Substrate. I cloned this repo and tried to compile Substrate/SubstrateCS/Examples/BlockReplace/Program.cs using Substrate/SubstrateCS/bin/Debug/Substrate.dll.

$ mcs /reference:Substrate.dll BlockReplace.cs
$ mono BlockReplace.exe ./path/to/my/world 32 48

But all I got was NullReferenceException. :<

Stack Traces

I tried debugging the issue by deleting a lot of the code. The issue is when I try to open the world, which doesn't return an NBTWorld, but instead null, which the IChunkManager chokes on.

using System;
using Substrate;

class MyProgram {
    static void Main (string[] args) {
        var path = "./workworkfashionbaby";
        try {
            NbtWorld world = NbtWorld.Open(path);
            IChunkManager cm = world.GetChunkManager();
        } catch (Exception error) {
            Console.WriteLine("Error: Failed to open world: " + path);
            Console.WriteLine("Exception: " + error.Message);
            Console.WriteLine(error.StackTrace);
            return;
        }
    }
}
Error: Failed to open world: ./workworkfashionbaby
Exception: Object reference not set to an instance of an object
  at Export.Main (System.String[] args) <0x545ed8 + 0x0002e> in <filename unknown>:0 

I also tried opening an AnvilWorld, not an NBTWorld, which did throw an error, instead of just silently returning null. It looks like it is finding the file, but for whatever reason, just isn't parsing the level?

class MyProgram {
    static void Main (string[] args) {
        var path = "./workworkfashionbaby";
        try {
            AnvilWorld world = AnvilWorld.Open(path);
        } catch (Exception error) {
            # ...
        }
    }
}
Error: Failed to open world: ./workworkfashionbaby
Exception: Failed to load 'level.dat'
  at Substrate.AnvilWorld.OpenWorld (System.String path) <0x4f2208 + 0x002cf> in <filename unknown>:0 
  at Substrate.AnvilWorld.Open (System.String path) <0x4f1078 + 0x0003b> in <filename unknown>:0 
  at Export.Main (System.String[] args) <0x4f0ed8 + 0x00027> in <filename unknown>:0 

What am I doing wrong?

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