Solved How to calculate to the left of the block of the previous location

Discussion in 'Spigot Plugin Help' started by Ded2332, Jul 12, 2021.

  1. I have a location, and in a block (or more) of it on the left side I want to spawn a mob. But I do not understand how to calculate the location, read the documentation, but still do not understand. I tried to shift the x and z coordinates, but it spawned on different sides.
     
  2. SteelPhoenix

    Moderator

    Left is a matter of perspective. You need to know where you're looking from.
     
  3. my location is directly in front of the player's face, and I want the second location to be a block to the left
     
  4. Code (Java):
    Block b;
    b.getRelative(BlockFace.WEST);
    //or          
    Location loc;
    loc.getBlock().getRelative(BlockFace.WEST);
    Might wanna use that and compare it to players facing or something along those lines
     
    #4 Zoltus, Jul 12, 2021
    Last edited: Jul 12, 2021
  5. I need to count from the first location, because the player's face will not always be needed