Solved Populating world with Custom Blocks that drop loot

Discussion in 'Plugin Development' started by Zombie__Hunter, Jun 9, 2022.

Thread Status:
Not open for further replies.
  1. Offline

    Zombie__Hunter

    I'm trying to populate my world with collectibles that drop unique items. The blocks are spawning and I'm saving their locations, but for some reason not all of the locations are being saved and I can't figure out why. It works perfectly until I reload or restart the server, then I have to reload it again for it to load the locations and some of the spawned blocks aren't saved into the locations.

    Adding the Populator:
    upload_2022-6-9_14-7-7.png

    The Populator:
    upload_2022-6-9_14-8-26.png

    addCollectible():
    upload_2022-6-9_14-10-24.png

    Loading them from the file:
    upload_2022-6-9_14-12-21.png

    Saving them to the file:
    upload_2022-6-9_14-13-7.png

    In Collectible enum:
    upload_2022-6-9_14-13-36.png
     

    Attached Files:

  2. Offline

    CraftCreeper6

    @Zombie__Hunter
    What does your config look like after saving the collectibles?
     
  3. Offline

    Zombie__Hunter

    upload_2022-6-9_17-10-52.png

    This continues for each type of collectible. When I stop and restart the server and teleport to a saved location, it doesn't drop the desired item. However, if I reload and then break it, it does. The plugin does load on startup which might affect that, but I can't really change that because that's how the populator works its magic.
     
  4. Offline

    CraftCreeper6

    @Zombie__Hunter
    In that case my guess is as good as yours, it's probably just that the chunks in question aren't rendered at onEnable. Maybe there's some chunk loading magic that you can do to change that?
     
  5. Offline

    Zombie__Hunter

    So the problem was that on startup the world is null. To fix it I made it load from the file using the WorldLoadEvent.
     
Thread Status:
Not open for further replies.

Share This Page