package com.tiedup.remake.util; import com.tiedup.remake.items.base.PoseType; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.item.ItemStack; /** * Centralizes human chair NBT tag keys and resolution logic. * *

The human chair mode is stored as NBT tags on the dog bind item. * This helper eliminates hardcoded string literals scattered across 7+ files. */ public final class HumanChairHelper { /** NBT key indicating this bind is in human chair mode */ public static final String NBT_KEY = "humanChairMode"; /** NBT key for the locked facing direction (degrees) */ public static final String NBT_FACING_KEY = "humanChairFacing"; private HumanChairHelper() {} /** * Check if a bind item is in human chair mode. * * @param bind The bind ItemStack to check * @return true if the bind has humanChairMode NBT set to true */ public static boolean isActive(ItemStack bind) { if (bind.isEmpty()) return false; CompoundTag tag = bind.getTag(); return tag != null && tag.getBoolean(NBT_KEY); } /** * Get the locked facing direction for human chair mode. * * @param bind The bind ItemStack * @return The facing angle in degrees, or 0 if not set */ public static float getFacing(ItemStack bind) { if (bind.isEmpty()) return 0f; CompoundTag tag = bind.getTag(); return tag != null ? tag.getFloat(NBT_FACING_KEY) : 0f; } /** * Resolve the effective pose type, overriding DOG to HUMAN_CHAIR * when the bind has humanChairMode enabled. * * @param base The base pose type from the bind item * @param bind The bind ItemStack (checked for humanChairMode NBT) * @return HUMAN_CHAIR if base is DOG and humanChairMode is active, otherwise base */ public static PoseType resolveEffectivePose(PoseType base, ItemStack bind) { if (base == PoseType.DOG && isActive(bind)) { return PoseType.HUMAN_CHAIR; } return base; } }