Floating items

Discussion in 'Plugin Development' started by MattTheBeast, Jun 22, 2017.

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

    MattTheBeast

    Hi, I was just wondering, is it possible to make items like a pickaxe float in the air above a block or something. I whant ti make a enchanting plugin where the pick will float in the air when its enchanted. Anybody know how?
     
  2. You can do it with armorstands... You can even animate them.

    Sent from my Xperia M4 Aqua using Tapatalk
     
  3. Offline

    MattTheBeast

    Ok il try, if possible can you send me some code example, iv never used armorstand before.

    @MGlolenstine

    Thats for the help and holy shit, the Euler Angles tho... can you save me some time and tell me the angle for the pick to be straight up xD

    thanks again

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Nov 25, 2017
  4. Summon an armorstand
    Code:
    ArmorStand stand = player.getLocation().getWorld().spawn(player.getLocation(), ArmorStand.class);
    Put an item in armorstand's hand
    Code:
    stand.setItemInHand(new ItemStack(Material.FISH, 1);
    That's it.
    You can make a stand invisible by doing
    Code:
    stand.setVisible(false);
    And for animations you can use this
    Code:
    stand.setRightArmPose(<Insert EulerAngle here>);
    Info on Euler Angles:
    Wikipedia
    Bukkit forums ;)

    Why not?

    This website might help you while you wait for my answer :)
    http://quaternions.online/

    Look at @Zombie_Striker 's reply here.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 15, 2018
    Zombie_Striker likes this.
  5. Offline

    Zombie_Striker

    @MattTheBeast
    Set the Y to 0. Then depending on the direction you want the forward bit to be facing, choose the X or Z coord and set one of those to 1,
     
  6. Doesn't euler have 3x XYZ? I just don't understand them and I still don't get why my replies need to get approved by a moderator... -_-

    Sent from my Xperia M4 Aqua using Tapatalk
     
  7. Offline

    MattTheBeast

    Thanks for the help, but its not the way I whant it, I whant it to look like this:

    pick -> ______
    |
    |

    on top
    of block: ________
    | |
    | |
    |_______|

    Edit: oops, the spaces screwd my demo :O

    like basicly I whant the pick to be straight up, where the wooden handler is looking at the block
     
  8. Use the website I sent you before... There you'll have 3D presentation of angles... Try adding 45 degrees for the pickaxe and try inserting new angles.


    P.s if you want spaces to matter, put it in [|code] blocks ok?
    Sent from my Xperia M4 Aqua using Tapatalk
     
  9. Offline

    Zombie_Striker

  10. Offline

    MattTheBeast

    public static void SpawnItem(Location loc, ItemStack item, Player p)
    {
    EulerAngle arm = new EulerAngle(1, 0, 0);

    ArmorStand as = p.getWorld().spawn(loc, ArmorStand.class);
    as.setCustomName("NormalItem");
    as.setCustomNameVisible(false);
    as.setGravity(false);
    as.setVisible(false);
    as.setRemoveWhenFarAway(false);
    as.setItemInHand(item);
    as.setRightArmPose(arm);
    as.setRemoveWhenFarAway(false);


    ex how I whant the pick to be:



    pick -> ______
    |
    |

    on top
    of block: ________
    | |
    | |
    |_______|

    Edit: Actually lets say the T is the pick

    T
    ___
    | _| <- thats the block


    }
     
  11. Even tho it's 00:21 for me rn :p
    I'll make a plugin and tell you the results.. :p
     
    Zombie_Striker likes this.
  12. Offline

    MattTheBeast


    Thank you so much, iv been working so hard on this plugin for my friend xD
     
  13. I'm so sorry, but it's late and I'm typing nonsense... I hope I can help you tomorrow (at least for me). Not just that... Now my eclipse got tired and it doesn't want to work anymore... :p

    Good night, if this issue isn't resolved 'till me waking up, I'll be glad to assist again.

    @timtower why do my replies have to wait for moderation? Am I on probation or something? Why do I sometimes have to wait and other times not? Please explain.
     
  14. Offline

    Caderape2

    @MattTheBeast
    you don't even need the armor stand. Just get the block location, clone it and add 0.5 Y, then drop the item at this location. A scheduler for update the position and cancel the pickupitemevent and you are done
     
  15. Offline

    MattTheBeast

    I figured a way that looks nice and my plugin is almost compleate, il send a picture when I'm done, it looks really cool.
     
  16. Offline

    timtower Administrator Administrator Moderator

    You have 3 warning points, then you get put back into the moderation queue yes.
    And sometimes you are but then we are fast enough for you to not notice it.
     
  17. Does this "Warning points" system ever reset? Do I get points by double posting?

    @MattTheBeast So you are done and you don't nedd my help anymore?
     
  18. Offline

    timtower Administrator Administrator Moderator

    Take this to PM instead.
     
Thread Status:
Not open for further replies.

Share This Page