Plugin-created entities don't always spawn

Discussion in 'Plugin Development' started by wristdirect, Nov 14, 2012.

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

    wristdirect

    I've been developing Turrets for the past month or so, and a problem that has been around since the very beginning is that sometimes (or for some people, all the time) the turret entities (which extend the minecart entity) don't always spawn correctly.

    In order to fix the problem, I made a special reload command for the plugin, which simply reloads the locations of and spawns all the turrets, which is exactly what the plugin does when it is enabled.

    I know Citizens had this problem a while back (I used it and had to use its custom reload command to get the citizens to spawn sometimes), but I never saw what solution they may have come to. I sent one of the developers a PM, but never got a response.

    Does anyone know what could be causing this problem and/or how to fix it?

    If you need any details about it, let me know and I'll provide :) (Also, if you want to bypass asking, you can always try and go straight to the source code; I always include it in the jar file.)

    Thanks guys!
     
  2. Offline

    md_5

    Hmm, sounds like a really odd issue. If you are using the minecraft server spawn(...) method (the nms one), it *should* spawn 100% of the time and be added to the correct places.
    Otherwise not too sure, lets try tagging aPunch and fullwall again :p
     
  3. Offline

    fullwall

    I think you may have PM'd aPunch, not sure if he has checked the forums in a while.

    Still haven't found a direct cause or solution to this problem unfortunately, sometimes it seems like certain combinations of plugins are the problem, might be to do with chunks unloading/loading (for example, MineBackup and PopulationDensity have been reported in the past).

    Are you using nms.spawn(entity, SpawnReason.CUSTOM)? Are you checking the return value of that function?
     
  4. Offline

    wristdirect

    Actually, it's using World.addEntity(entity). A lot of the original nms stuff was written by azazad when he first made the plugin. I've added some other overrides for things like mounting and stuff, but the spawn part was something he originally wrote. I could try changing it if you think it might help the problem?

    Also, thanks for the help, this is a tough nut to crack :D
     
  5. Offline

    fireblast709

    Why not use World.spawnEntity()?
     
  6. Offline

    wristdirect

    Is there an easy way to spawn a custom class that way? Currently the plugin makes an entire entity, with lots of custom info, then when the spawn method is called, the class that links to the entity adds it via the addEntity command.
     
  7. Offline

    fullwall

    wristdirect - sorry, was working off of md_5's post. SpawnReason.CUSTOM stops certain plugins/world limits from blocking the spawn. The result should be checked to see whether it was successful.
     
Thread Status:
Not open for further replies.

Share This Page