Files
TiedUp-/src/main/java/com/tiedup/remake/state/components/PlayerDataRetrieval.java
NotEvil a71093ba9c Remove internal phase comments and format code
Strip all Phase references, TODO/FUTURE roadmap notes, and internal
planning comments from the codebase. Run Prettier for consistent
formatting across all Java files.
2026-04-12 01:25:55 +02:00

134 lines
3.6 KiB
Java

package com.tiedup.remake.state.components;
import com.tiedup.remake.items.base.ItemCollar;
import com.tiedup.remake.state.hosts.IPlayerBindStateHost;
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() &&
collar.getItem() instanceof ItemCollar collarItem
) {
// Try to get nickname from collar NBT
String nickname = collarItem.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 (collar.getItem() instanceof ItemCollar collarItem) {
String nickname = collarItem.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();
}
}