Head Item vector and armor stand lay

Discussion in 'Plugin Development' started by danichef, Apr 22, 2017.

Thread Status:
Not open for further replies.
  1. Hello, I've been trying to add a vector to the item in the head here:
    Code:
                Player player = event.getPlayer();
                Location loc = player.getLocation();
                Location l2 = new Location(player.getWorld(), loc.getX(), loc.getY()-1, loc.getZ());
                l2.setDirection(l2.getDirection());
                ArmorStand stand = player.getLocation().getWorld().spawn(l2, ArmorStand.class);
                stand.setBasePlate(false); 
                stand.setVisible(false);
                stand.setGravity(false);
                ItemStack head = new ItemStack(Material.IRON_SWORD, 1);
                stand.setHelmet(head);
    Any idea how can I add a vector so sword looks like lying?
    Also how can I make an armor stand lay?
    Thanks.
     
  2. Code:
    l2.setDirection(l2.getDirection());
    
    This is unnecessary. Youre setting the direction to what it already is.
    Code:
    ArmorStand stand = player.getLocation().getWorld().spawn(l2, ArmorStand.class);
    
    Why do you do player.getLocation again? You already created a loc variable which is the player's location. You can just do
    Code:
    ArmorStand stand = loc.getWorld().spawn(l2, ArmorStand.class);
    
     
  3. @MisterMel Thx for advice. I supose that for what Im searching for is direction since I did it to the direction player is looking.
     
  4. Not pretty sure how to use it and as they said its not really the best thing to experiment with....
     
Thread Status:
Not open for further replies.

Share This Page