Spawn with Data

Discussion in 'Plugin Development' started by 567legodude, Sep 2, 2014.

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

    567legodude

    So, ingame you can do commands like
    /summon MinecartRideable ~ ~ ~ {CustomDisplayTile:1,DisplayTile:1,DisplayOffset:6,Rotation:[0f,0f,0f]}
    To spawn a minecart with stone in it, and like you may also see, you can set the rotation of the minecart when it is spawned.
    So can someone tell me the code to spawn an Entity at an already known location, with certain data, such as the ones in the command above. How do I spawn an entity with data at a known location?
     
  2. Offline

    mythbusterma

    567legodude

    Use World#spawnEntity (Location, EntityType) and apply modifiers like riders to the return value.
     
    BillyGalbreath likes this.
  3. Offline

    567legodude

    mythbusterma Could you show an example of some code to do that. I don't know about modifiers, but if I see an example I would probably understand it.
     
  4. Offline

    BillyGalbreath

    Why does everyone say that? Google. Or use the Plugin Requests forum if you want code written for you.
     
  5. Offline

    mythbusterma

    567legodude

    Just look at the JavaDocs for the methods you're looking for. Something like setRotation() or setDirection() might be in there somewhere.
     
  6. Offline

    567legodude

    BillyGalbreath I posted in this forum because I am making the plugin myself. I came here because I could not get a search for what I wanted.
     
Thread Status:
Not open for further replies.

Share This Page