Load Schematic in Direction Player is Facing?

Discussion in 'Spigot Plugin Development' started by ReadySetPawn, Sep 12, 2015.

  1. So I'm using the WorldEdit API and I need to paste a schematic with a certain rotation depending on which way the player is facing. I don't even know how to set the schematics direction or check to see if the player is facing north, south, east, or west. How would I go about doing this?
     
  2. Admittedly I've never attempted to do this but here are some things that might get you started.

    This is the rotate command in WorldEdit, maybe you can try rotating in a similar way. From inspection of the ClipboardHolder class it appears you can construct one with a Clipboard and WorldData. There's probably a way to get WorldData like how you get WE's player type and the Clipboard is just an extension of an Extent but maybe you already know how to get one of those.

    As for getting the direction the player is facing, you could use either location.getDirection() or location.getYaw() on the player's location. The former returns a vector with x/y/z values specifying the direction the player is looking in. The latter is an angle from 0 to 360. I'm unsure of which values are which direction but I'm sure a little trial and error would figure that problem out. (there's probably also info on the minecraft wiki regarding cardinal direction regarding +ve/-ve x/z directions)