Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException when creating world with custom chunk provider #80

Open
tuxillator opened this issue Jan 25, 2015 · 2 comments
Open

Comments

@tuxillator
Copy link

I'm getting a NullPointerException when trying to create a world with a custom chunk provider. Seems to be related to the WorldProvider (don't know why... I'm registering a custom DimensionType, nothing to do with WorldType):

> createworld sandbox nothanks sandbox
[00:41:50] [CanaryMod] [INFO] [NOTICE]: Please wait while the world is generated...
[00:41:50] [CanaryMod] [INFO] [NOTICE]: Failed to create world. Check console for errors.
[00:41:50] [CanaryMod] [ERROR]: Exception thrown while creating a world
java.lang.NullPointerException
        at net.minecraft.world.World.<init>(World.java:132) ~[CanaryMod-1.8.0-1.2.0-SNAPSHOT-shaded.jar:1.8.0-1.2.0-SNAPSHOT]
        at net.minecraft.world.WorldServer.<init>(WorldServer.java:101) ~[CanaryMod-1.8.0-1.2.0-SNAPSHOT-shaded.jar:1.8.0-1.2.0-SNAPSHOT]
        at net.minecraft.world.WorldServerMulti.<init>(WorldServerMulti.java:18) ~[CanaryMod-1.8.0-1.2.0-SNAPSHOT-shaded.jar:1.8.0-1.2.0-SNAPSHOT]
        at net.canarymod.api.world.CanaryWorldManager.createWorld(CanaryWorldManager.java:239) ~[CanaryMod-1.8.0-1.2.0-SNAPSHOT-shaded.jar:1.8.0-1.2.0-SNAPSHOT]
        at net.canarymod.api.world.CanaryWorldManager.createWorld(CanaryWorldManager.java:205) ~[CanaryMod-1.8.0-1.2.0-SNAPSHOT-shaded.jar:1.8.0-1.2.0-SNAPSHOT]
        at net.canarymod.commandsys.commands.world.CreateWorldCommand.execute(CreateWorldCommand.java:54) [CanaryMod-1.8.0-1.2.0-SNAPSHOT-shaded.jar:1.8.0-1.2.0-SNAPSHOT]
        at net.canarymod.commandsys.CommandList.createWorld(CommandList.java:2008) [CanaryMod-1.8.0-1.2.0-SNAPSHOT-shaded.jar:1.8.0-1.2.0-SNAPSHOT]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_25]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_25]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_25]
        at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_25]
        at net.canarymod.commandsys.CommandManager$1.execute(CommandManager.java:322) [CanaryMod-1.8.0-1.2.0-SNAPSHOT-shaded.jar:1.8.0-1.2.0-SNAPSHOT]
        at net.canarymod.commandsys.CanaryCommand.parseCommand(CanaryCommand.java:103) [CanaryMod-1.8.0-1.2.0-SNAPSHOT-shaded.jar:1.8.0-1.2.0-SNAPSHOT]
        at net.canarymod.commandsys.CommandManager.parseCommand(CommandManager.java:189) [CanaryMod-1.8.0-1.2.0-SNAPSHOT-shaded.jar:1.8.0-1.2.0-SNAPSHOT]
        at net.canarymod.api.CanaryServer.consoleCommand(CanaryServer.java:170) [CanaryMod-1.8.0-1.2.0-SNAPSHOT-shaded.jar:1.8.0-1.2.0-SNAPSHOT]
        at net.minecraft.server.dedicated.DedicatedServer$2.run(DedicatedServer.java:139) [CanaryMod-1.8.0-1.2.0-SNAPSHOT-shaded.jar:1.8.0-1.2.0-SNAPSHOT]
@tuxillator
Copy link
Author

There's some funny signature stuff going on with WorldType, DimensionType and DimensionProvider.

world = (WorldServer) new WorldServerMulti(mcserver, isavehandler, dimType.getId(), (WorldServer) ((CanaryWorld) getWorld(name, net.canarymod.api.world.DimensionType.NORMAL, true)).getHandle(), mcserver.b, worldinfo).b();

3rd parameter of WorldServerMulti() is eventually the world type, but here it's looking up dimension type instead.

Further, the getWorld() call dimension type is hardcoded to NORMAL, explaining some of the weird errors I get when debug logging is enabled:

> createworld sandbox nothanks sandbox
[01:49:54] [CanaryMod] [INFO] [NOTICE]: Please wait while the world is generated...
[01:49:54] [CanaryMod] [INFO]: Could not find the world configuration for sandbox_SANDBOX at config/worlds/sandbox, creating default.
[01:49:54] [CanaryMod] [DEBUG]: Updating new config for sandbox_SANDBOX
[01:49:54] [CanaryMod] [DEBUG]: World sandboxdoes not exist, we can autoload, will load!
[01:49:54] [CanaryMod] [DEBUG]: Config already exists for sandbox_NORMAL
[01:49:54] [net.minecraft.server.MinecraftServer] [INFO]: Preparing start region for level sandbox_NORMAL (0)
[01:49:55] [net.minecraft.server.MinecraftServer] [INFO]: Preparing spawn area: 8%
[01:49:56] [net.minecraft.server.MinecraftServer] [INFO]: Preparing spawn area: 16%
[01:49:57] [net.minecraft.server.MinecraftServer] [INFO]: Preparing spawn area: 26%
[01:49:58] [net.minecraft.server.MinecraftServer] [INFO]: Preparing spawn area: 38%
[01:49:59] [net.minecraft.server.MinecraftServer] [INFO]: Preparing spawn area: 51%
[01:50:00] [net.minecraft.server.MinecraftServer] [INFO]: Preparing spawn area: 61%
[01:50:01] [net.minecraft.server.MinecraftServer] [INFO]: Preparing spawn area: 72%
[01:50:02] [net.minecraft.server.MinecraftServer] [INFO]: Preparing spawn area: 84%
[01:50:03] [net.minecraft.server.MinecraftServer] [INFO]: Preparing spawn area: 98%
[01:50:03] [CanaryMod] [DEBUG]: Adding new world to world manager, filed as sandbox_NORMAL
[01:50:03] [CanaryMod] [INFO] [NOTICE]: Failed to create world. Check console for errors.
[01:50:03] [CanaryMod] [ERROR]: Exception thrown while creating a world
java.lang.NullPointerException

@damagefilter
Copy link
Member

The custom world provider is not properly implemented and not tested at all. Sorry.
If you happen to know your way around worldgen, we're open for suggestions and hints on implementing it properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants