Get ChunkSnapshot from CraftChunkSnapshot

Discussion in 'Spigot Plugin Development' started by NubeBuster, May 24, 2016.

  1. I am trying to generate caves using my custom ChunkGenerator.
    The WorldGenCaves generate function takes among others ChunkSnapshot.
    I can get the CraftChunkSnapshot using source.getChunkSnapshot() but I don't know how to get the ChunkSnapshot from that.

    When I say ChunkSnapshot I mean net.minecraft.server.v1_8_R3.ChunkSnapshot

    Not working solution: ((ChunkSnapshot) source.getChunkSnapshot()).getHandle()
    that function doesn't exist.
  2. Maybe you should use org.bukkit.ChunkSnapshot instead
  3. Well, that is what I have.
    I need to turn that into the net.minecraft.server.v1_8_R3.ChunkSnapshot
  4. Why would you use the v1_8_R3 when you can use the one in org.bukkit..?
  5. DId you read the post?
    Code (Text):
    WorldGenCaves wgc = new WorldGenCaves();
                wgc.a(((CraftWorld) world).getHandle().chunkProviderServer.chunkProvider, ((CraftWorld) world).getHandle(),
                        x, z,snapshot);
    the snapshot parameter needs to be
    and I have org.bukkit.ChunkSnapshot
  6. MiniDigger


    there is no easy way because bukkits chunk snapshot has no reference to the nms one (thats why there is no getHandle method)
    try constructing a new nms chunksnapshot via the constructors
  7. I have tried that. But the caves simply don't spawn. However, this might not be caused by the chunksnapshot, but by something else. I am unsure.
  8. Is there possibly a better way to generate caves using a custom ChunkGenerator?

    I am trying to look into the Terrain Control code to see how they are doing it, but they are really serious with abstraction so I spend much more time than needed with no result.