Spawner Minecarts

Discussion in 'Plugin Development' started by Zachster, May 26, 2013.

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

    Zachster

    Has anyone found a way to make Spawner Minecarts in the API?
     
  2. Offline

    Jogy34

    You should just be able to do
    Code:
    world.spawnEntity(Location, EntityType.MINECART_MOB_SPAWNER );
    
     
  3. Offline

    Zachster

    Thanks. How do you set entity it spawns?
     
  4. Offline

    Jogy34

    Looking through the javadocs it doesn't look like you can with just the bukkit API. I could probably write up a quick thing using craftbukkit/NMS code to be able to do it but the problem with that is it will break on pretty much every bukkit update since they implemented dynamically changing package names.
     
  5. Offline

    Zachster

    Maybe I could treat it like a normal spawner and use the methods for this in a normal spawner. The only problem I see with this is a casting problem. Spawners are treated as blocks not entities.

    Maybe I can try setPassenger. Doubt it will work but I can try.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  6. Offline

    Jogy34

    Yea, that wouldn't work. SpawnerMinecart is an empty interface that inherits from Minecart so there are no methods that would allow you to get the spawner in it or set the spawner in it and if you were to attempt to cast it to a spawner it would throw a ClassCastException. There are still a lot of things like that that aren't fully implemented into the API yet. It wouldn't be too hard to do it through NMS though but, again, there is the dynamic package names problem.
     
Thread Status:
Not open for further replies.

Share This Page