package com.tiedup.remake.entities.damsel.hosts;

import com.tiedup.remake.entities.AbstractTiedUpNpc;
import com.tiedup.remake.entities.damsel.components.IAnimationHost;
import net.minecraft.world.level.Level;

/**
 * Host implementation for AnimationController callbacks.
 * Extracted from EntityDamsel inner class for better organization.
 *
 */
public class AnimationHost implements IAnimationHost {

    private final AbstractTiedUpNpc entity;

    public AnimationHost(AbstractTiedUpNpc entity) {
        this.entity = entity;
    }

    @Override
    public Level level() {
        return entity.level();
    }

    @Override
    public float getYBodyRot() {
        return entity.yBodyRot;
    }

    @Override
    public void setYBodyRot(float rot) {
        entity.yBodyRot = rot;
    }

    @Override
    public float getYBodyRotO() {
        return entity.yBodyRotO;
    }

    @Override
    public void setYBodyRotO(float rot) {
        entity.yBodyRotO = rot;
    }

    @Override
    public boolean isDogPose() {
        return entity.isDogPose();
    }

    @Override
    public boolean isSittingFromData() {
        return entity.getEntityData().get(AbstractTiedUpNpc.DATA_SITTING);
    }

    @Override
    public void setSittingToData(boolean sitting) {
        entity.getEntityData().set(AbstractTiedUpNpc.DATA_SITTING, sitting);
    }

    @Override
    public boolean isKneelingFromData() {
        return entity.getEntityData().get(AbstractTiedUpNpc.DATA_KNEELING);
    }

    @Override
    public void setKneelingToData(boolean kneeling) {
        entity.getEntityData().set(AbstractTiedUpNpc.DATA_KNEELING, kneeling);
    }

    @Override
    public boolean isStrugglingFromData() {
        return entity.getEntityData().get(AbstractTiedUpNpc.DATA_STRUGGLING);
    }

    @Override
    public void setStrugglingToData(boolean struggling) {
        entity
            .getEntityData()
            .set(AbstractTiedUpNpc.DATA_STRUGGLING, struggling);
    }
}
