Forwarding to you @Zbob750. Hoping you'll be able to provide a possible workaround fix. :( See http://dev.enginehub.org/youtrack/issue/CRAFTBOOK-3213#comment=67-12350
Paper dev 910
CraftBook dev 82
ProtocolLib dev 329
How are we trying to reject the changes? I remember looking for it but I either couldn't find it or got caught up with something else.
@me4502
Uh, I don't know - all I know is that if a player is on an armour stand, setting the rotation of it doesn't work. It does work in Sponge however, so I'm assuming spigot is blocking it somewhere.
I believe this was fixed upstream recently.
@mibby can you confirm?
This is still an issue for me as of Paper dev 958 and CraftBook dev 92. Not sure if it is still broken in Spigot or if @me4502 has to make a change in craftbook to rotate the armorstand with the player when the player rotates to avoid the head snapping.
@Zbob750 Follow-up to this problem from me4502.
It wasn't fixed in this commit. https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/5245147d004f648afcddec6a689e60d451c027bf
That sets the head rotation, which is not what is wanted.
In Sponge both rotationPitch and rotationYaw are manually set, which me4502 believes is what fixes the issue.
Thank you for that, I just pushed b6c1b2d3e71864746fd82bfd03e37b80074f5a05 up to master for this.
It seemed to be working exactly as I would expect testing against CraftBook's "chairs" module.
Please test against build 1025 and let me know.
@Zbob750 I am not sure if @me4502 has to make any additional changes to CraftBook to account for the new change, but I am still able to reproduce head snapping with the CraftBook chair mechanic.
Paper dev 1025
CraftBook dev 108
https://www.dropbox.com/s/iuawf0jr5hjzth5/2017-01-07%2019-44-58.mkv?dl=0
Unless you are only accounting for the initial teleportation to a mounted entity and not updating the yaw/pitch when a player rotates?
I misunderstood the issue.
It appears as though NMS does this itself anyway, but I attempted to manually set rotationPitch and rotationYaw (pitch and yaw respectively in CB mappings) immediately after and before the teleport and it doesn't seem to resolve this issue either.
Odd. Might need to wait for @me4502 to clarify further then.
@Zbob750 According to me4502, this is still broken in Spigot itself.
http://dev.enginehub.org/youtrack/issue/CRAFTBOOK-3213#comment=67-12551
I'm aware, I'm just not aware of what Spigot is doing that breaks it.
Quick follow-up. Still broken as of Paper dev 1052 and CraftBook dev 120. Head snapping still occurs when rotating in a chair, the body doesn't face the same direction as the head.
Still broken as of Paper dev 1059 and CraftBook dev 124. Surely my spine isn't broken from trying to sit straight? :P 
@mibby

This isn't a bug. ArmorStands are "technically" living creatures (according to Mojang), so you are stuck with the logic of having your legs restricted to that of riding any living creature. To get the desired effect you will have to rotate the armorstand with the player to make the legs rotate too. Or, ride something that's not a living entity, like an arrow. Afaik the eject from arrow NaN location issue was fixed years ago.
Issue with riding arrows is they鈥檙e quite often deleted by servers/plugins despite the age value. That鈥檚 the reason it was moved away in the first place.
Ok, then just rotate the armorstand.

public class TestPlugin extends JavaPlugin {
@Override
public void onLoad() {
Map<Object, Type<?>> dataTypes = (Map<Object, Type<?>>) DataConverterRegistry.a().getSchema(15190).findChoiceType(DataConverterTypes.n).types();
dataTypes.put("minecraft:chair", dataTypes.get("minecraft:armorstand"));
EntityTypes.a("chair", EntityTypes.a.a(Chair.class, Chair::new));
}
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(new Listener() {
@EventHandler
public void onClickChair(PlayerInteractEvent event) {
Block block = event.getClickedBlock();
if (block != null && Tag.STAIRS.isTagged(block.getType())) {
WorldServer world = ((CraftWorld) block.getWorld()).getHandle();
Chair chair = new Chair(world, block);
if (world.addEntity(chair)) {
EntityPlayer player = ((CraftPlayer) event.getPlayer()).getHandle();
player.yaw = chair.yaw;
player.pitch = 0;
if (player.startRiding(chair)) event.setCancelled(true);
}
}
}
}, this);
}
public class Chair extends EntityArmorStand {
private int noRiderTicks = 0;
public Chair(World world) {
super(world);
setMarker(true);
setNoGravity(true);
setCustomName(new ChatComponentText("chair"));
setCustomNameVisible(false);
setInvisible(true);
}
public Chair(World world, Block block) {
this(world);
int degrees = ((Stairs) block.getBlockData()).getFacing().ordinal() * 90;
double radians = Math.toRadians(degrees);
Vector vec = block.getLocation().toVector().add(new Vector(0.5, 0.25, 0.5))
.add(new Vector(-Math.sin(radians) * 0.2, 0, Math.cos(radians) * 0.2));
setPositionRotation(vec.getX(), vec.getY(), vec.getZ(), degrees, 0);
}
public void k() {
if (noRiderTicks > 5) die();
if (passengers == null || passengers.isEmpty()) noRiderTicks++;
else setYawPitch(passengers.get(0).yaw, noRiderTicks = 0);
super.k();
}
}
}
But that鈥檚 not using the API ;)
Yup, was just a quick example. Using the API would have made the example much longer lol
Point is, just rotate the armorstand (by any means necessary) with the player's yaw
Oh, that鈥檚 the actual issue here - you can鈥檛 rotate the armour stand through the API.
Ooohhhh! Well then.. I'll dig into that this weekend. Probably another stupid md5 thing that just need to be reverted.
you can鈥檛 rotate the armour stand through the API.
Should be possible now with Entity#setRotation(float, float)
Can confirm it's fixed using API.
import org.bukkit.Location;
import org.bukkit.Tag;
import org.bukkit.block.Block;
import org.bukkit.block.data.Directional;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import org.spigotmc.event.entity.EntityDismountEvent;
public class TestPlugin extends JavaPlugin {
public void onEnable() {
getServer().getPluginManager().registerEvents(new Listener() {
@EventHandler
public void onClickChair(PlayerInteractEvent event) {
Block block = event.getClickedBlock();
if (block != null && Tag.STAIRS.isTagged(block.getType())) {
Entity armorstand = block.getWorld().spawnEntity(block.getLocation().add(0.5, -0.5, 0.5), EntityType.ARMOR_STAND);
int yaw = ((Directional) block.getBlockData()).getFacing().ordinal() * 90;
armorstand.setRotation(yaw, 0);
Player player = event.getPlayer();
player.teleport(armorstand.getLocation());
if (armorstand.addPassenger(player)) {
event.setCancelled(true);
}
}
}
@EventHandler
public void onChairEject(EntityDismountEvent event) {
Entity vehicle = event.getDismounted();
if (vehicle.getType() == EntityType.ARMOR_STAND) {
vehicle.remove();
}
}
}, this);
new BukkitRunnable() {
public void run() {
getServer().getOnlinePlayers().forEach(player -> {
Entity vehicle = player.getVehicle();
if (vehicle instanceof ArmorStand) {
Location loc = player.getLocation();
vehicle.setRotation(loc.getYaw(), 0);
}
});
}
}.runTaskTimer(this, 1, 1);
}
}
Can confirm this is still fixed over a year later. Should close this ticket..
Love to see it
Most helpful comment
@mibby
