Rotating a item in the player's hand

  • I would like to create a plugin that automatically rotates a sapling / seed (for aesthetic purposes). I cannot find an event for onChangeQuickSlotFocus so I have decided that my code should trigger on the completion of PlayerPlaceVegetationEvent.


    Although Player and WorldItem have getRotation() and setRotation(), it seems that Item does not.


    Can anyone suggest how I can change the rotation of the held sapling?


    Thanks!

  • You mean change the rotation upon placement right? You cannot change the rotation of the item in your hand i.e. see the item from a different angle while holding it.


    Short answer you cannot do it. The PlayerVegetationEvent (which is extended by the PlayerPlaceVegetationEvent) does not include a .setRotation() or a .setPosition() method. It only includes .getRotation() and .getPosition() methods.


    maybe @red51 could add the .set[Rotation/Position]() methods? :/

  • Technically prior to placing. There must be a quaternion in there somewhere because when you're holding a seedling and use arrow keys, the ghost-image of the seedling will turn. But yeah, you get what I mean.


    Thanks for the comprehensive answer. I'll add it to the API wishlist!

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!