Rotating an Armor Stand


#1

I’m trying to put a banner on an Armor Stand, then have it rotate until it is parallel to the ground. Currently, my code sets rotation of the armor stand by using the setRotation(Vector3d) method for entities. However, even when I do that, the armor stand doesn’t even turn.

Could someone tell me how they’re rotating their armor stands, and how to do it so the banner is made perpendicular to the ground?


#2

I haven’t used Sponge for quite some time, so forgive me if I am wrong on this one.

But if I remember correctly how everything works (this means visiting the java docs), you’ll have to modify the “BodyPartRotationalData” of the ArmorStand. Since an ArmorStand inherits functions from CompositeValueStore (because an ArmorStand extends Living, which extends Entity, which extends DataHolder, which extends CompositeValuestore) you should be able to set the rotation using the defined rotational Keys - from BodyPartRotationalData - using the offer() function on your ArmorStand “instance”.

Pseudo-code:

armorStandInstance.offer(Keys.LEFT_ARM_ROTATION, Vector3d);

#3

Another question. How do you put a banner in the hand of an armor stand?


#4

I think by using the setItemInHand() function from ArmorEquipable (ArmorStand extends this interface). I think you can use MAIN_HAND (from HandTypes) for the right arm and OFF_HAND for the left arm (but I am not sure).