package net.minecraft.world.entity.animal;

import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.Level;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.TamableAnimal;

public abstract class ShoulderRidingEntity extends TamableAnimal {
    private int rideCooldownCounter;
    
    protected ShoulderRidingEntity(final EntityType<? extends ShoulderRidingEntity> aku, final Level bjw) {
        super(aku, bjw);
    }
    
    public boolean setEntityOnShoulder(final ServerPlayer xe) {
        final CompoundTag jt3 = new CompoundTag();
        jt3.putString("id", this.getEncodeId());
        this.saveWithoutId(jt3);
        if (xe.setEntityOnShoulder(jt3)) {
            this.remove();
            return true;
        }
        return false;
    }
    
    @Override
    public void tick() {
        ++this.rideCooldownCounter;
        super.tick();
    }
    
    public boolean canSitOnShoulder() {
        return this.rideCooldownCounter > 100;
    }
}
