Search in sources :

Example 1 with AbstractHorseEntity

use of net.minecraft.entity.passive.horse.AbstractHorseEntity in project ChocolateQuestRepoured by TeamChocoQuest.

the class EntityAIRideHorse method onMountHorse.

protected void onMountHorse() {
    this.removeHorseAI();
    if (this.horse instanceof AbstractHorseEntity) {
        AbstractHorseEntity h = (AbstractHorseEntity) this.horse;
        h.equipSaddle(SoundCategory.AMBIENT);
        h.setEating(false);
        // Previously setRearing, is this the correct replacement?
        h.setJumping(false);
    }
    this.applyModifiers();
}
Also used : AbstractHorseEntity(net.minecraft.entity.passive.horse.AbstractHorseEntity)

Example 2 with AbstractHorseEntity

use of net.minecraft.entity.passive.horse.AbstractHorseEntity in project ChocolateQuestRepoured by TeamChocoQuest.

the class EntityAISearchMount method tick.

@Override
public void tick() {
    if (this.entity.distanceTo(this.entityToMount) > DISTANCE_TO_MOUNT) {
        this.entity.getNavigation().moveTo(this.entityToMount, WALK_SPEED_TO_MOUNT);
    } else {
        if (this.entityToMount instanceof AbstractHorseEntity) {
            AbstractHorseEntity horse = (AbstractHorseEntity) this.entityToMount;
            horse.setOwnerUUID(this.entity.getUUID());
            // TODO: Replace
            // this.world.setEntityState(horse, (byte) 7);
            horse.setTamed(true);
            horse.equipSaddle(SoundCategory.AMBIENT);
            // Should that stay? -> Arlo says yes.
            horse.setSlot(400, new ItemStack(Items.SADDLE));
            horse.setSlot(401, new ItemStack(Items.IRON_HORSE_ARMOR));
        }
        this.entity.getNavigation().stop();
        this.entity.startRiding(this.entityToMount, FORCE_MOUNTING);
    }
}
Also used : AbstractHorseEntity(net.minecraft.entity.passive.horse.AbstractHorseEntity) ItemStack(net.minecraft.item.ItemStack)

Aggregations

AbstractHorseEntity (net.minecraft.entity.passive.horse.AbstractHorseEntity)2 ItemStack (net.minecraft.item.ItemStack)1