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> aoq, final Level bqb) {
        super(aoq, bqb);
    }
    
    public boolean setEntityOnShoulder(final ServerPlayer ze) {
        final CompoundTag le3 = new CompoundTag();
        le3.putString("id", this.getEncodeId());
        this.saveWithoutId(le3);
        if (ze.setEntityOnShoulder(le3)) {
            this.remove();
            return true;
        }
        return false;
    }
    
    @Override
    public void tick() {
        ++this.rideCooldownCounter;
        super.tick();
    }
    
    public boolean canSitOnShoulder() {
        return this.rideCooldownCounter > 100;
    }
}
