Files
TiedUp-/src/main/java/com/tiedup/remake/state/components/PlayerDataRetrieval.java
NotEvil 449178f57b feat(D-01/C): consumer migration — 85 files migrated to V2 helpers
Phase 1 (state): PlayerBindState, PlayerCaptorManager, PlayerEquipment,
  PlayerDataRetrieval, PlayerLifecycle, PlayerShockCollar, StruggleAccessory
Phase 2 (client): AnimationTickHandler, NpcAnimationTickHandler, 5 render
  handlers, DamselModel, 3 client mixins, SelfBondageInputHandler,
  SlaveManagementScreen, ActionPanel, SlaveEntryWidget, ModKeybindings
Phase 3 (entities): 28 entity/AI files migrated to CollarHelper,
  BindModeHelper, PoseTypeHelper, createStack()
Phase 4 (network): PacketSlaveAction, PacketMasterEquip,
  PacketAssignCellToCollar, PacketNpcCommand, PacketFurnitureForcemount
Phase 5 (events): RestraintTaskTickHandler, PetPlayRestrictionHandler,
  PlayerEnslavementHandler, ChatEventHandler, LaborAttackPunishmentHandler
Phase 6 (commands): BondageSubCommand, CollarCommand, NPCCommand,
  KidnapSetCommand
Phase 7 (compat): MCAKidnappedAdapter, MCA mixins
Phase 8 (misc): GagTalkManager, PetRequestManager, HangingCagePiece,
  BondageItemBlockEntity, TrappedChestBlockEntity, DispenserBehaviors,
  BondageItemLoaderUtility, RestraintApplicator, StruggleSessionManager,
  MovementStyleResolver, CampLifecycleManager

Some files retain dual V1/V2 checks (instanceof V1 || V2Helper) for
coexistence — V1-only branches removed in Branch D.
2026-04-15 00:16:50 +02:00

131 lines
3.5 KiB
Java

package com.tiedup.remake.state.components;
import com.tiedup.remake.state.hosts.IPlayerBindStateHost;
import com.tiedup.remake.v2.bondage.CollarHelper;
import com.tiedup.remake.v2.BodyRegionV2;
import com.tiedup.remake.v2.bondage.capability.V2EquipmentHelper;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
/**
* Component responsible for retrieving player data and equipment.
* Provides access to current bondage items and player information.
*
* Single Responsibility: Data retrieval
* Complexity: LOW (simple getters)
* Risk: LOW (read-only access)
*
* Epic 5F: Uses V2EquipmentHelper/BodyRegionV2.
*/
public class PlayerDataRetrieval {
private final IPlayerBindStateHost host;
public PlayerDataRetrieval(IPlayerBindStateHost host) {
this.host = host;
}
// ========== Equipment Getters ==========
public ItemStack getCurrentBind() {
return V2EquipmentHelper.getInRegion(
host.getPlayer(),
BodyRegionV2.ARMS
);
}
public ItemStack getCurrentGag() {
return V2EquipmentHelper.getInRegion(
host.getPlayer(),
BodyRegionV2.MOUTH
);
}
public ItemStack getCurrentBlindfold() {
return V2EquipmentHelper.getInRegion(
host.getPlayer(),
BodyRegionV2.EYES
);
}
public ItemStack getCurrentEarplugs() {
return V2EquipmentHelper.getInRegion(
host.getPlayer(),
BodyRegionV2.EARS
);
}
public ItemStack getCurrentClothes() {
return V2EquipmentHelper.getInRegion(
host.getPlayer(),
BodyRegionV2.TORSO
);
}
public ItemStack getCurrentMittens() {
return V2EquipmentHelper.getInRegion(
host.getPlayer(),
BodyRegionV2.HANDS
);
}
public ItemStack getCurrentCollar() {
return V2EquipmentHelper.getInRegion(
host.getPlayer(),
BodyRegionV2.NECK
);
}
// ========== Player Information ==========
/**
* Get the player's display name, checking collar for nickname first.
* If collar has a nickname, returns that; otherwise returns player name.
*/
public String getNameFromCollar() {
Player player = host.getPlayer();
ItemStack collar = getCurrentCollar();
if (!collar.isEmpty() && CollarHelper.isCollar(collar)) {
// Try to get nickname from collar NBT
String nickname = CollarHelper.getNickname(collar);
if (nickname != null && !nickname.isEmpty()) {
return nickname;
}
}
// Fallback to player name
return player.getName().getString();
}
/**
* Check if player has a named collar (collar with nickname).
*/
public boolean hasNamedCollar() {
ItemStack collar = getCurrentCollar();
if (collar.isEmpty()) return false;
if (CollarHelper.isCollar(collar)) {
String nickname = CollarHelper.getNickname(collar);
return nickname != null && !nickname.isEmpty();
}
return false;
}
/**
* Check if player has clothes with small arms flag.
*/
public boolean hasClothesWithSmallArms() {
return false;
}
/**
* Get the player as a LivingEntity.
* Used for generic entity operations.
*/
public LivingEntity asLivingEntity() {
return host.getPlayer();
}
}