mojira.dev
MC-259778

Placing a saddle on a Skeleton Trap stops the Skeleton Horse from moving

How to reproduce

  1. Run:

    /summon skeleton_horse ~ ~ ~ {SkeletonTrap:1b}
  2. Right click all of the horses with saddles whilst the skeletons are riding

  3. Run away and notice that the skeletons on the horses can't follow you

Video

Linked issues

Comments 7

I can confirm

Could be fixed by disallowing use-equipping when the mob has a passenger already. Would also be quite intuitive if you ask me.

This issue is still present on Minecraft 1.19.4 pre-release 1. Note that it also affects camels as the mount entity and any non-player living entity passenger with the /ride command.

Code analysis (Yarn mappings)

The default travel behavior for a horse is overridden when it has a steering passenger as determined by the AbstractHorseEntity#getPrimaryPassenger method. This allows players to substitute a horse's travel behavior for their own movement.

However, the way the steering passenger is determined has a flaw. For reference, this is the entire method:

public LivingEntity getPrimaryPassenger() {
	if (this.isSaddled() && this.getFirstPassenger() instanceof LivingEntity livingEntity) {
		return livingEntity;
	}
	return null;
}

To summarize, the travel behavior will be overridden if a living entity is riding a saddled horse. This works for unsaddled horses, where the travel behavior is not overridden, and saddled horses ridden by players, where the travel behavior is substituted for the player's movement. This leaves the case where a saddled horse is ridden by a non-player living entity. In this case, the travel behavior will be overridden, but there is no substitute movement defined. As a result, the horse will not move.

One suggested fix is to simply reduce the steering player case to players when the horse is saddled:

public LivingEntity getPrimaryPassenger() {
	if (this.isSaddled() && this.getFirstPassenger() instanceof PlayerEntity playerEntity) {
		return playerEntity;
	}
	return null;
}

This mixin implements such a change:

@Mixin(AbstractHorseEntity.class)
public abstract class AbstractHorseEntityMixin extends AnimalEntity implements Saddleable {
	protected AbstractHorseEntityMixin(EntityType<? extends AnimalEntity> entityType, World world) {
		super(entityType, world);
	}

	@Overwrite
	public LivingEntity getPrimaryPassenger() {
		if (this.isSaddled() && this.getFirstPassenger() instanceof PlayerEntity playerEntity) {
			return playerEntity;
		}
		return null;
	}
}

I cannot reproduce this issue anymore on Minecraft 1.19.4 release candidate 3. It seems like the issue instead is that skeleton horses controlled by skeletons will only move after they have been hit for a short while.

Blocked by MC-260974.

Cannot reproduce in 23w13a and 23w14a.

Can confirm fixed in 23w13a.

Shuddery

elvendorke

Confirmed

Expansion A

Important

Mob behaviour

1.19.3, 23w05a, 23w06a, 1.19.4 Pre-release 1

23w13a

Retrieved