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.
This commit is contained in:
@@ -22,16 +22,13 @@ import net.minecraft.world.level.Level;
|
||||
* - Call for help system (captive calling for rescue)
|
||||
* - Leash traction system (prevents stuck while leashed)
|
||||
*
|
||||
* Phase 5: Extracted from EntityDamsel.java (~450 lines, 5 methods)
|
||||
*/
|
||||
public class DamselAIController {
|
||||
|
||||
private final EntityDamsel entity;
|
||||
private final IAIHost host;
|
||||
|
||||
// ========================================
|
||||
// CALL FOR HELP SYSTEM
|
||||
// ========================================
|
||||
|
||||
/** Cooldown between call for help messages */
|
||||
private int callForHelpCooldown = 0;
|
||||
@@ -45,9 +42,7 @@ public class DamselAIController {
|
||||
/** Maximum cooldown for call for help (10 seconds) */
|
||||
private static final int CALL_FOR_HELP_COOLDOWN_MAX = 200;
|
||||
|
||||
// ========================================
|
||||
// LEASH TRACTION SYSTEM
|
||||
// ========================================
|
||||
|
||||
/** Counter for how long NPC has been stuck while leashed */
|
||||
private int leashStuckCounter = 0;
|
||||
@@ -76,18 +71,14 @@ public class DamselAIController {
|
||||
/** FIX: Force ramp factor - gradual increase based on distance */
|
||||
private static final double LEASH_FORCE_RAMP = 0.05;
|
||||
|
||||
// ========================================
|
||||
// CONSTRUCTOR
|
||||
// ========================================
|
||||
|
||||
public DamselAIController(EntityDamsel entity, IAIHost host) {
|
||||
this.entity = entity;
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// AI GOALS REGISTRATION
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Register all AI goals for this entity.
|
||||
@@ -154,9 +145,7 @@ public class DamselAIController {
|
||||
goalSelector.addGoal(7, new OpenDoorGoal(entity, false));
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// COMMAND GOALS UTILITY
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Register all NPC command goals on a goal selector.
|
||||
@@ -193,9 +182,7 @@ public class DamselAIController {
|
||||
goalSelector.addGoal(priority, new NpcSortCommandGoal(entity, 1.0));
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// CALL FOR HELP SYSTEM
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Periodically call for help to nearby players when being led as a captive.
|
||||
@@ -282,9 +269,7 @@ public class DamselAIController {
|
||||
}
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// LEASH TRACTION SYSTEM
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Tick leash traction system for NPCs.
|
||||
|
||||
@@ -6,8 +6,8 @@ import dev.kosmx.playerAnim.api.layered.IAnimation;
|
||||
import dev.kosmx.playerAnim.impl.animation.AnimationApplier;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Manages all animation-related systems for EntityDamsel:
|
||||
@@ -16,15 +16,12 @@ import net.minecraft.resources.ResourceLocation;
|
||||
* - Pose management (sitting, kneeling, dog, struggling, trembling)
|
||||
* - Dog pose rotation smoothing
|
||||
*
|
||||
* Phase 3: Extracted from EntityDamsel.java (~220 lines, 14 methods)
|
||||
*/
|
||||
public class DamselAnimationController {
|
||||
|
||||
private final IAnimationHost host;
|
||||
|
||||
// ========================================
|
||||
// ANIMATION SYSTEM
|
||||
// ========================================
|
||||
|
||||
/** Animation stack for PlayerAnimator mod */
|
||||
private final AnimationStack animationStack = new AnimationStack();
|
||||
@@ -38,9 +35,7 @@ public class DamselAnimationController {
|
||||
private final Map<ResourceLocation, IAnimation> storedAnimations =
|
||||
new HashMap<>();
|
||||
|
||||
// ========================================
|
||||
// DOG POSE ROTATION SMOOTHING
|
||||
// ========================================
|
||||
|
||||
/** Rotation smoother for DOG pose (prevents sudden spinning) */
|
||||
private final RotationSmoother dogPoseRotationSmoother =
|
||||
@@ -49,17 +44,13 @@ public class DamselAnimationController {
|
||||
/** Track DOG pose state for transition detection */
|
||||
private boolean wasInDogPose = false;
|
||||
|
||||
// ========================================
|
||||
// CONSTRUCTOR
|
||||
// ========================================
|
||||
|
||||
public DamselAnimationController(IAnimationHost host) {
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// TICK LOGIC
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Tick animation systems BEFORE super.tick().
|
||||
@@ -126,9 +117,7 @@ public class DamselAnimationController {
|
||||
return false; // Server-side, continue with tick logic
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// IANIMATEDPLAYER INTERFACE
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Get the animation stack.
|
||||
@@ -184,9 +173,7 @@ public class DamselAnimationController {
|
||||
return this.storedAnimations.put(id, animation);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// POSE MANAGEMENT
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Check if NPC is currently sitting.
|
||||
|
||||
@@ -4,10 +4,10 @@ import com.tiedup.remake.entities.DamselVariant;
|
||||
import com.tiedup.remake.entities.EntityDamsel;
|
||||
import com.tiedup.remake.entities.skins.DamselSkinManager;
|
||||
import com.tiedup.remake.entities.skins.Gender;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Manages the visual appearance of a Damsel NPC.
|
||||
@@ -18,7 +18,6 @@ import net.minecraft.resources.ResourceLocation;
|
||||
* - Slim arms flag
|
||||
* - Custom name
|
||||
*
|
||||
* Phase 1 of EntityDamsel refactoring (8 phases total).
|
||||
*/
|
||||
public class DamselAppearance {
|
||||
|
||||
@@ -44,9 +43,7 @@ public class DamselAppearance {
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// VARIANT SYSTEM
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Get the current variant.
|
||||
@@ -113,9 +110,7 @@ public class DamselAppearance {
|
||||
this.variant = null;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// SLIM ARMS
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Check if this damsel uses slim arms model.
|
||||
@@ -133,9 +128,7 @@ public class DamselAppearance {
|
||||
this.entity.getEntityData().set(EntityDamsel.DATA_SLIM_ARMS, slimArms);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// GENDER
|
||||
// ========================================
|
||||
|
||||
public void setGender(Gender gender) {
|
||||
this.entity.getEntityData().set(
|
||||
@@ -150,9 +143,7 @@ public class DamselAppearance {
|
||||
);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// SKIN TEXTURE
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Get the skin texture for this entity.
|
||||
@@ -170,9 +161,7 @@ public class DamselAppearance {
|
||||
return DEFAULT_DAMSEL_TEXTURE;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// NAME SYSTEM
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Get NPC's custom name.
|
||||
@@ -193,9 +182,7 @@ public class DamselAppearance {
|
||||
this.entity.setCustomNameVisible(true);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// NBT SERIALIZATION
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Save appearance data to NBT tag.
|
||||
|
||||
@@ -4,14 +4,14 @@ import com.tiedup.remake.core.TiedUpMod;
|
||||
import com.tiedup.remake.entities.AbstractTiedUpNpc;
|
||||
import com.tiedup.remake.entities.BondageServiceHandler;
|
||||
import com.tiedup.remake.items.base.ItemCollar;
|
||||
import com.tiedup.remake.state.ICaptor;
|
||||
import com.tiedup.remake.state.IRestrainable;
|
||||
import com.tiedup.remake.state.IRestrainableEntity;
|
||||
import com.tiedup.remake.v2.BodyRegionV2;
|
||||
import com.tiedup.remake.state.ICaptor;
|
||||
import com.tiedup.remake.util.RestraintEffectUtils;
|
||||
import com.tiedup.remake.util.tasks.ItemTask;
|
||||
import com.tiedup.remake.util.teleport.Position;
|
||||
import com.tiedup.remake.util.teleport.TeleportHelper;
|
||||
import com.tiedup.remake.v2.BodyRegionV2;
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
@@ -38,9 +38,7 @@ import net.minecraft.world.level.Level;
|
||||
*/
|
||||
public class DamselBondageManager implements IRestrainable {
|
||||
|
||||
// ========================================
|
||||
// FIELDS
|
||||
// ========================================
|
||||
|
||||
private final AbstractTiedUpNpc entity;
|
||||
private final IBondageHost host;
|
||||
@@ -52,9 +50,7 @@ public class DamselBondageManager implements IRestrainable {
|
||||
private boolean forSale;
|
||||
private ItemTask salePrice;
|
||||
|
||||
// ========================================
|
||||
// CONSTRUCTOR
|
||||
// ========================================
|
||||
|
||||
public DamselBondageManager(AbstractTiedUpNpc entity, IBondageHost host) {
|
||||
this.entity = entity;
|
||||
@@ -66,9 +62,7 @@ public class DamselBondageManager implements IRestrainable {
|
||||
this.salePrice = null;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// SUB-COMPONENT ACCESS
|
||||
// ========================================
|
||||
|
||||
/** Expose equipment sub-component for direct access where needed. */
|
||||
public NpcEquipmentManager getEquipmentManager() {
|
||||
@@ -80,27 +74,83 @@ public class DamselBondageManager implements IRestrainable {
|
||||
return captivity;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// IBondageState DELEGATION -> equipment
|
||||
// ========================================
|
||||
|
||||
@Override public boolean isTiedUp() { return equipment.isTiedUp(); }
|
||||
@Override public boolean isGagged() { return equipment.isGagged(); }
|
||||
@Override public boolean isBlindfolded() { return equipment.isBlindfolded(); }
|
||||
@Override public boolean hasEarplugs() { return equipment.hasEarplugs(); }
|
||||
@Override public boolean hasCollar() { return equipment.hasCollar(); }
|
||||
@Override public boolean hasClothes() { return equipment.hasClothes(); }
|
||||
@Override public boolean hasMittens() { return equipment.hasMittens(); }
|
||||
@Override public boolean isBoundAndGagged() { return equipment.isBoundAndGagged(); }
|
||||
@Override public boolean hasGaggingEffect() { return equipment.hasGaggingEffect(); }
|
||||
@Override public boolean hasBlindingEffect() { return equipment.hasBlindingEffect(); }
|
||||
@Override public boolean hasKnives() { return equipment.hasKnives(); }
|
||||
@Override public boolean hasClothesWithSmallArms() { return equipment.hasClothesWithSmallArms(); }
|
||||
@Override public boolean hasLockedCollar() { return equipment.hasLockedCollar(); }
|
||||
@Override public boolean hasNamedCollar() { return equipment.hasNamedCollar(); }
|
||||
@Override
|
||||
public boolean isTiedUp() {
|
||||
return equipment.isTiedUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGagged() {
|
||||
return equipment.isGagged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlindfolded() {
|
||||
return equipment.isBlindfolded();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEarplugs() {
|
||||
return equipment.hasEarplugs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCollar() {
|
||||
return equipment.hasCollar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasClothes() {
|
||||
return equipment.hasClothes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMittens() {
|
||||
return equipment.hasMittens();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBoundAndGagged() {
|
||||
return equipment.isBoundAndGagged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGaggingEffect() {
|
||||
return equipment.hasGaggingEffect();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBlindingEffect() {
|
||||
return equipment.hasBlindingEffect();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasKnives() {
|
||||
return equipment.hasKnives();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasClothesWithSmallArms() {
|
||||
return equipment.hasClothesWithSmallArms();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLockedCollar() {
|
||||
return equipment.hasLockedCollar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNamedCollar() {
|
||||
return equipment.hasNamedCollar();
|
||||
}
|
||||
|
||||
// V2 region-based equipment access
|
||||
@Override public ItemStack getEquipment(BodyRegionV2 region) { return equipment.getInRegion(region); }
|
||||
@Override
|
||||
public ItemStack getEquipment(BodyRegionV2 region) {
|
||||
return equipment.getInRegion(region);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void equip(BodyRegionV2 region, ItemStack stack) {
|
||||
@@ -112,18 +162,39 @@ public class DamselBondageManager implements IRestrainable {
|
||||
case NECK -> equipment.putCollarOn(stack);
|
||||
case TORSO -> equipment.putClothesOn(stack);
|
||||
case HANDS -> equipment.putMittensOn(stack);
|
||||
default -> {}
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Equipment putters (local delegates — no longer in interface, but still called by legacy code)
|
||||
public void putBindOn(ItemStack bind) { equipment.putBindOn(bind); }
|
||||
public void putGagOn(ItemStack gag) { equipment.putGagOn(gag); }
|
||||
public void putBlindfoldOn(ItemStack blindfold) { equipment.putBlindfoldOn(blindfold); }
|
||||
public void putEarplugsOn(ItemStack earplugs) { equipment.putEarplugsOn(earplugs); }
|
||||
public void putCollarOn(ItemStack collar) { equipment.putCollarOn(collar); }
|
||||
public void putClothesOn(ItemStack clothes) { equipment.putClothesOn(clothes); }
|
||||
public void putMittensOn(ItemStack mittens) { equipment.putMittensOn(mittens); }
|
||||
public void putBindOn(ItemStack bind) {
|
||||
equipment.putBindOn(bind);
|
||||
}
|
||||
|
||||
public void putGagOn(ItemStack gag) {
|
||||
equipment.putGagOn(gag);
|
||||
}
|
||||
|
||||
public void putBlindfoldOn(ItemStack blindfold) {
|
||||
equipment.putBlindfoldOn(blindfold);
|
||||
}
|
||||
|
||||
public void putEarplugsOn(ItemStack earplugs) {
|
||||
equipment.putEarplugsOn(earplugs);
|
||||
}
|
||||
|
||||
public void putCollarOn(ItemStack collar) {
|
||||
equipment.putCollarOn(collar);
|
||||
}
|
||||
|
||||
public void putClothesOn(ItemStack clothes) {
|
||||
equipment.putClothesOn(clothes);
|
||||
}
|
||||
|
||||
public void putMittensOn(ItemStack mittens) {
|
||||
equipment.putMittensOn(mittens);
|
||||
}
|
||||
|
||||
// Equipment removers (V2 region-based)
|
||||
@Override
|
||||
@@ -149,18 +220,45 @@ public class DamselBondageManager implements IRestrainable {
|
||||
}
|
||||
|
||||
// Legacy equipment removers (local delegates for internal use)
|
||||
public ItemStack takeBindOff() { return equipment.takeBindOff(); }
|
||||
public ItemStack takeGagOff() { return equipment.takeGagOff(); }
|
||||
public ItemStack takeBlindfoldOff() { return equipment.takeBlindfoldOff(); }
|
||||
public ItemStack takeEarplugsOff() { return equipment.takeEarplugsOff(); }
|
||||
public ItemStack takeCollarOff() { return equipment.takeCollarOff(); }
|
||||
public ItemStack takeCollarOff(boolean force) { return equipment.takeCollarOff(force); }
|
||||
public ItemStack takeClothesOff() { return equipment.takeClothesOff(); }
|
||||
public ItemStack takeMittensOff() { return equipment.takeMittensOff(); }
|
||||
public ItemStack takeBindOff() {
|
||||
return equipment.takeBindOff();
|
||||
}
|
||||
|
||||
public ItemStack takeGagOff() {
|
||||
return equipment.takeGagOff();
|
||||
}
|
||||
|
||||
public ItemStack takeBlindfoldOff() {
|
||||
return equipment.takeBlindfoldOff();
|
||||
}
|
||||
|
||||
public ItemStack takeEarplugsOff() {
|
||||
return equipment.takeEarplugsOff();
|
||||
}
|
||||
|
||||
public ItemStack takeCollarOff() {
|
||||
return equipment.takeCollarOff();
|
||||
}
|
||||
|
||||
public ItemStack takeCollarOff(boolean force) {
|
||||
return equipment.takeCollarOff(force);
|
||||
}
|
||||
|
||||
public ItemStack takeClothesOff() {
|
||||
return equipment.takeClothesOff();
|
||||
}
|
||||
|
||||
public ItemStack takeMittensOff() {
|
||||
return equipment.takeMittensOff();
|
||||
}
|
||||
|
||||
// Equipment replacer (V2 region-based)
|
||||
@Override
|
||||
public ItemStack replaceEquipment(BodyRegionV2 region, ItemStack newStack, boolean force) {
|
||||
public ItemStack replaceEquipment(
|
||||
BodyRegionV2 region,
|
||||
ItemStack newStack,
|
||||
boolean force
|
||||
) {
|
||||
return switch (region) {
|
||||
case ARMS -> equipment.replaceBind(newStack, force);
|
||||
case MOUTH -> equipment.replaceGag(newStack, force);
|
||||
@@ -176,67 +274,181 @@ public class DamselBondageManager implements IRestrainable {
|
||||
// Bulk operations
|
||||
@Override
|
||||
public void applyBondage(
|
||||
ItemStack bind, ItemStack gag, ItemStack blindfold,
|
||||
ItemStack earplugs, ItemStack collar, ItemStack clothes
|
||||
ItemStack bind,
|
||||
ItemStack gag,
|
||||
ItemStack blindfold,
|
||||
ItemStack earplugs,
|
||||
ItemStack collar,
|
||||
ItemStack clothes
|
||||
) {
|
||||
equipment.applyBondage(bind, gag, blindfold, earplugs, collar, clothes);
|
||||
}
|
||||
|
||||
@Override public void dropBondageItems(boolean drop) { equipment.dropBondageItems(drop); }
|
||||
@Override public void dropBondageItems(boolean drop, boolean dropBind) { equipment.dropBondageItems(drop, dropBind); }
|
||||
@Override
|
||||
public void dropBondageItems(
|
||||
boolean drop, boolean dropBind, boolean dropGag,
|
||||
boolean dropBlindfold, boolean dropEarplugs,
|
||||
boolean dropCollar, boolean dropClothes
|
||||
) {
|
||||
equipment.dropBondageItems(drop, dropBind, dropGag, dropBlindfold,
|
||||
dropEarplugs, dropCollar, dropClothes);
|
||||
public void dropBondageItems(boolean drop) {
|
||||
equipment.dropBondageItems(drop);
|
||||
}
|
||||
|
||||
@Override public void dropClothes() { equipment.dropClothes(); }
|
||||
@Override public int getBondageItemsWhichCanBeRemovedCount() { return equipment.getBondageItemsWhichCanBeRemovedCount(); }
|
||||
@Override public boolean canBeTiedUp() { return equipment.canBeTiedUp(); }
|
||||
@Override
|
||||
public void dropBondageItems(boolean drop, boolean dropBind) {
|
||||
equipment.dropBondageItems(drop, dropBind);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropBondageItems(
|
||||
boolean drop,
|
||||
boolean dropBind,
|
||||
boolean dropGag,
|
||||
boolean dropBlindfold,
|
||||
boolean dropEarplugs,
|
||||
boolean dropCollar,
|
||||
boolean dropClothes
|
||||
) {
|
||||
equipment.dropBondageItems(
|
||||
drop,
|
||||
dropBind,
|
||||
dropGag,
|
||||
dropBlindfold,
|
||||
dropEarplugs,
|
||||
dropCollar,
|
||||
dropClothes
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropClothes() {
|
||||
equipment.dropClothes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBondageItemsWhichCanBeRemovedCount() {
|
||||
return equipment.getBondageItemsWhichCanBeRemovedCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeTiedUp() {
|
||||
return equipment.canBeTiedUp();
|
||||
}
|
||||
|
||||
// Permissions
|
||||
@Override public boolean canTakeOffClothes(Player player) { return equipment.canTakeOffClothes(player); }
|
||||
@Override public boolean canChangeClothes(Player player) { return equipment.canChangeClothes(player); }
|
||||
@Override public boolean canChangeClothes() { return equipment.canChangeClothes(); }
|
||||
@Override
|
||||
public boolean canTakeOffClothes(Player player) {
|
||||
return equipment.canTakeOffClothes(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canChangeClothes(Player player) {
|
||||
return equipment.canChangeClothes(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canChangeClothes() {
|
||||
return equipment.canChangeClothes();
|
||||
}
|
||||
|
||||
// ICoercible DELEGATION -> equipment
|
||||
@Override public void tighten(Player tightener) { equipment.tighten(tightener); }
|
||||
@Override public void applyChloroform(int duration) { equipment.applyChloroform(duration); }
|
||||
@Override public void shockKidnapped() { equipment.shockKidnapped(); }
|
||||
@Override public void shockKidnapped(String messageAddon, float damage) { equipment.shockKidnapped(messageAddon, damage); }
|
||||
@Override public void takeBondageItemBy(IRestrainableEntity taker, int slotIndex) { equipment.takeBondageItemBy(taker, slotIndex); }
|
||||
@Override
|
||||
public void tighten(Player tightener) {
|
||||
equipment.tighten(tightener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyChloroform(int duration) {
|
||||
equipment.applyChloroform(duration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shockKidnapped() {
|
||||
equipment.shockKidnapped();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shockKidnapped(String messageAddon, float damage) {
|
||||
equipment.shockKidnapped(messageAddon, damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void takeBondageItemBy(IRestrainableEntity taker, int slotIndex) {
|
||||
equipment.takeBondageItemBy(taker, slotIndex);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// ICapturable DELEGATION -> captivity
|
||||
// ========================================
|
||||
|
||||
@Override public boolean isCaptive() { return captivity.isCaptive(); }
|
||||
@Override public boolean isEnslavable() { return captivity.isEnslavable(); }
|
||||
@Override public ICaptor getCaptor() { return captivity.getCaptor(); }
|
||||
@Override public boolean getCapturedBy(ICaptor newCaptor) { return captivity.getCapturedBy(newCaptor); }
|
||||
@Override public void free() { captivity.free(); }
|
||||
@Override public void free(boolean transportState) { captivity.free(transportState); }
|
||||
@Override public void transferCaptivityTo(ICaptor newCaptor) { captivity.transferCaptivityTo(newCaptor); }
|
||||
@Override public boolean isTiedToPole() { return captivity.isTiedToPole(); }
|
||||
@Override public boolean tieToClosestPole(int searchRadius) { return captivity.tieToClosestPole(searchRadius); }
|
||||
@Override public boolean canBeKidnappedByEvents() { return captivity.canBeKidnappedByEvents(); }
|
||||
@Override @Nullable public Entity getTransport() { return null; } // NPCs use vanilla leash directly
|
||||
@Override
|
||||
public boolean isCaptive() {
|
||||
return captivity.isCaptive();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnslavable() {
|
||||
return captivity.isEnslavable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICaptor getCaptor() {
|
||||
return captivity.getCaptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getCapturedBy(ICaptor newCaptor) {
|
||||
return captivity.getCapturedBy(newCaptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void free() {
|
||||
captivity.free();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void free(boolean transportState) {
|
||||
captivity.free(transportState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transferCaptivityTo(ICaptor newCaptor) {
|
||||
captivity.transferCaptivityTo(newCaptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTiedToPole() {
|
||||
return captivity.isTiedToPole();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tieToClosestPole(int searchRadius) {
|
||||
return captivity.tieToClosestPole(searchRadius);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeKidnappedByEvents() {
|
||||
return captivity.canBeKidnappedByEvents();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Entity getTransport() {
|
||||
return null;
|
||||
} // NPCs use vanilla leash directly
|
||||
|
||||
// Public methods not on IRestrainable but used externally
|
||||
public void clearCaptor() { captivity.clearCaptor(); }
|
||||
public boolean forceCapturedBy(ICaptor newCaptor) { return captivity.forceCapturedBy(newCaptor); }
|
||||
public void restoreCaptorFromUUID() { captivity.restoreCaptorFromUUID(); }
|
||||
public void clearCaptor() {
|
||||
captivity.clearCaptor();
|
||||
}
|
||||
|
||||
public boolean forceCapturedBy(ICaptor newCaptor) {
|
||||
return captivity.forceCapturedBy(newCaptor);
|
||||
}
|
||||
|
||||
public void restoreCaptorFromUUID() {
|
||||
captivity.restoreCaptorFromUUID();
|
||||
}
|
||||
|
||||
// Collar owner check (public, used by AbstractTiedUpNpc)
|
||||
public boolean isCollarOwner(Player player) { return equipment.isCollarOwner(player); }
|
||||
public boolean isCollarOwner(Player player) {
|
||||
return equipment.isCollarOwner(player);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// ISaleable -- INLINE (4 methods, 2 fields)
|
||||
// ========================================
|
||||
|
||||
@Override
|
||||
public boolean isForSell() {
|
||||
@@ -276,9 +488,7 @@ public class DamselBondageManager implements IRestrainable {
|
||||
salePrice = null;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// IRestrainableEntity -- IDENTITY (stays in facade)
|
||||
// ========================================
|
||||
|
||||
@Override
|
||||
public LivingEntity asLivingEntity() {
|
||||
@@ -320,9 +530,7 @@ public class DamselBondageManager implements IRestrainable {
|
||||
TeleportHelper.teleportEntity(entity, position);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// CROSS-CUTTING METHODS (stay in facade)
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Untie: crosses both equipment and captivity domains.
|
||||
@@ -402,9 +610,7 @@ public class DamselBondageManager implements IRestrainable {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// BONDAGE SERVICE DELEGATION
|
||||
// ========================================
|
||||
|
||||
public boolean isBondageServiceEnabled() {
|
||||
return bondageService.isEnabled();
|
||||
@@ -432,9 +638,7 @@ public class DamselBondageManager implements IRestrainable {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// PERSISTENCE ORCHESTRATION
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Save bondage state to NBT.
|
||||
|
||||
@@ -7,7 +7,6 @@ import net.minecraft.nbt.CompoundTag;
|
||||
* Orchestrates NBT serialization/deserialization for all EntityDamsel components.
|
||||
* Provides a single entry point for save/load operations.
|
||||
*
|
||||
* Phase 8: Final refactoring phase - NBT orchestration.
|
||||
*/
|
||||
public class DamselDataSerializer {
|
||||
|
||||
@@ -24,12 +23,10 @@ public class DamselDataSerializer {
|
||||
* @param tag NBT compound tag to write to
|
||||
*/
|
||||
public void save(CompoundTag tag) {
|
||||
// Phase 1: Appearance (variant, gender, name, slim arms)
|
||||
entity.getAppearance().saveToTag(tag);
|
||||
|
||||
// Bondage + Inventory are now saved by AbstractTiedUpNpc.addAdditionalSaveData()
|
||||
|
||||
// Phase 6: Personality (traits, needs, relationships, commands)
|
||||
entity.getPersonalitySystem().saveToTag(tag);
|
||||
|
||||
// Reward tracker (savior, rewards)
|
||||
@@ -43,12 +40,10 @@ public class DamselDataSerializer {
|
||||
* @param tag NBT compound tag to read from
|
||||
*/
|
||||
public void load(CompoundTag tag) {
|
||||
// Phase 1: Appearance (variant, gender, name, slim arms)
|
||||
entity.getAppearance().loadFromTag(tag);
|
||||
|
||||
// Bondage + Inventory are now loaded by AbstractTiedUpNpc.readAdditionalSaveData()
|
||||
|
||||
// Phase 6: Personality (traits, needs, relationships, commands)
|
||||
entity.getPersonalitySystem().loadFromTag(tag);
|
||||
|
||||
// Reward tracker (savior, rewards)
|
||||
|
||||
@@ -13,7 +13,6 @@ import net.minecraft.world.entity.player.Player;
|
||||
* - Radius-based dialogue (talkToPlayersInRadius, actionToPlayersInRadius)
|
||||
* - Cooldown management for dialogue categories
|
||||
*
|
||||
* Phase 4: Extracted from EntityDamsel.java (~180 lines, 9 methods)
|
||||
*/
|
||||
public class DamselDialogueHandler {
|
||||
|
||||
@@ -27,9 +26,7 @@ public class DamselDialogueHandler {
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// DIRECT DIALOGUE
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Send a direct message to a player.
|
||||
@@ -67,9 +64,7 @@ public class DamselDialogueHandler {
|
||||
EntityDialogueManager.actionTo(host.getEntity(), player, category);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// RADIUS-BASED DIALOGUE
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Send a message to all players within radius.
|
||||
|
||||
@@ -32,7 +32,6 @@ import net.minecraft.world.level.block.entity.ChestBlockEntity;
|
||||
* - Feeding system (auto-eat, player feeding)
|
||||
* - MenuProvider (GUI access)
|
||||
*
|
||||
* Phase 2 of EntityDamsel refactoring (8 phases total).
|
||||
*/
|
||||
public class DamselInventoryManager {
|
||||
|
||||
@@ -62,9 +61,7 @@ public class DamselInventoryManager {
|
||||
this.armorInventory = NonNullList.withSize(4, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// EQUIPMENT SLOTS
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Get item in equipment slot.
|
||||
@@ -116,7 +113,9 @@ public class DamselInventoryManager {
|
||||
* Implements Mob.getMainHandItem().
|
||||
*/
|
||||
public ItemStack getMainHandItem() {
|
||||
return this.entity.getEntityData().get(AbstractTiedUpNpc.DATA_MAIN_HAND);
|
||||
return this.entity.getEntityData().get(
|
||||
AbstractTiedUpNpc.DATA_MAIN_HAND
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,12 +124,13 @@ public class DamselInventoryManager {
|
||||
* @param stack Item to hold
|
||||
*/
|
||||
public void setMainHandItem(ItemStack stack) {
|
||||
this.entity.getEntityData().set(AbstractTiedUpNpc.DATA_MAIN_HAND, stack);
|
||||
this.entity.getEntityData().set(
|
||||
AbstractTiedUpNpc.DATA_MAIN_HAND,
|
||||
stack
|
||||
);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// NPC INVENTORY
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Get the NPC's carry inventory.
|
||||
@@ -178,9 +178,7 @@ public class DamselInventoryManager {
|
||||
this.npcInventorySize = newSize;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// FEEDING SYSTEM
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Check if the NPC has any edible item in their inventory.
|
||||
@@ -376,7 +374,10 @@ public class DamselInventoryManager {
|
||||
? "action.feed.starving"
|
||||
: "action.feed";
|
||||
// Cast safe: feedByPlayer is only called from EntityDamsel which IS an EntityDamsel
|
||||
if (this.entity instanceof com.tiedup.remake.entities.EntityDamsel damsel) {
|
||||
if (
|
||||
this.entity instanceof
|
||||
com.tiedup.remake.entities.EntityDamsel damsel
|
||||
) {
|
||||
com.tiedup.remake.dialogue.EntityDialogueManager.talkByDialogueId(
|
||||
damsel,
|
||||
player,
|
||||
@@ -387,9 +388,7 @@ public class DamselInventoryManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// MENU PROVIDER
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Create inventory menu for player access.
|
||||
@@ -415,9 +414,7 @@ public class DamselInventoryManager {
|
||||
);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// NBT SERIALIZATION
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Save inventory data to NBT tag.
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
package com.tiedup.remake.entities.damsel.components;
|
||||
|
||||
import com.tiedup.remake.core.TiedUpMod;
|
||||
import com.tiedup.remake.v2.BodyRegionV2;
|
||||
import com.tiedup.remake.dialogue.EntityDialogueManager;
|
||||
import com.tiedup.remake.items.base.ItemCollar;
|
||||
import com.tiedup.remake.personality.*;
|
||||
import com.tiedup.remake.v2.BodyRegionV2;
|
||||
import java.util.*;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Manages all personality-related systems for EntityDamsel:
|
||||
@@ -21,16 +21,13 @@ import net.minecraft.world.item.ItemStack;
|
||||
* - Rest/fatigue modifiers
|
||||
* - Command execution
|
||||
*
|
||||
* Phase 6: Extracted from EntityDamsel.java (~700 lines, 22 methods)
|
||||
*/
|
||||
public class DamselPersonalitySystem {
|
||||
|
||||
private final com.tiedup.remake.entities.EntityDamsel entity;
|
||||
private final IPersonalityTickContext context;
|
||||
|
||||
// ========================================
|
||||
// DIALOGUE SYSTEM CONSTANTS
|
||||
// ========================================
|
||||
|
||||
/** Minimum cooldown between idle dialogues (4 minutes). */
|
||||
private static final int IDLE_DIALOGUE_COOLDOWN_MIN = 4800;
|
||||
@@ -47,9 +44,7 @@ public class DamselPersonalitySystem {
|
||||
/** Approach detection radius (blocks). */
|
||||
private static final double APPROACH_RADIUS = 5.0;
|
||||
|
||||
// ========================================
|
||||
// REST SYSTEM CONSTANTS
|
||||
// ========================================
|
||||
|
||||
/** UUID for rest-based speed modifier. */
|
||||
private static final UUID REST_SPEED_MODIFIER_UUID = UUID.fromString(
|
||||
@@ -64,9 +59,7 @@ public class DamselPersonalitySystem {
|
||||
/** Ticks between rest modifier updates (1 second). */
|
||||
private static final int REST_MODIFIER_UPDATE_INTERVAL = 20;
|
||||
|
||||
// ========================================
|
||||
// PERSONALITY STATE
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Complete personality state including:
|
||||
@@ -82,9 +75,7 @@ public class DamselPersonalitySystem {
|
||||
@Nullable
|
||||
private PersonalityState personalityState;
|
||||
|
||||
// ========================================
|
||||
// DIALOGUE COOLDOWNS
|
||||
// ========================================
|
||||
|
||||
/** Cooldown for idle dialogue (in ticks). */
|
||||
private int idleDialogueCooldown = 0;
|
||||
@@ -107,9 +98,7 @@ public class DamselPersonalitySystem {
|
||||
Long
|
||||
> dialogueCooldowns = new HashMap<>();
|
||||
|
||||
// ========================================
|
||||
// REST SYSTEM MODIFIERS
|
||||
// ========================================
|
||||
|
||||
/** Last applied speed modifier from rest system */
|
||||
private float lastRestSpeedMod = 0.0f;
|
||||
@@ -117,9 +106,7 @@ public class DamselPersonalitySystem {
|
||||
/** Last applied damage modifier from rest system */
|
||||
private float lastRestDamageMod = 0.0f;
|
||||
|
||||
// ========================================
|
||||
// ANTI-FLEE SYSTEM
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* World time when last whipped.
|
||||
@@ -127,9 +114,7 @@ public class DamselPersonalitySystem {
|
||||
*/
|
||||
private long lastWhipTime = 0;
|
||||
|
||||
// ========================================
|
||||
// CONSTRUCTOR
|
||||
// ========================================
|
||||
|
||||
public DamselPersonalitySystem(
|
||||
com.tiedup.remake.entities.EntityDamsel entity,
|
||||
@@ -139,9 +124,7 @@ public class DamselPersonalitySystem {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// INITIALIZATION & SYNC
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Initialize personality state with random generation.
|
||||
@@ -184,9 +167,7 @@ public class DamselPersonalitySystem {
|
||||
}
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// TICK LOGIC
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Main personality tick - delegates to PersonalityState and handles side effects.
|
||||
@@ -336,9 +317,7 @@ public class DamselPersonalitySystem {
|
||||
}
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// DIALOGUE SYSTEMS
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Tick idle dialogue system (random chatter).
|
||||
@@ -554,9 +533,7 @@ public class DamselPersonalitySystem {
|
||||
}
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// PUBLIC PERSONALITY API
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Get the personality state (lazy-init on server side).
|
||||
@@ -643,9 +620,7 @@ public class DamselPersonalitySystem {
|
||||
this.lastWhipTime = time;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// NBT PERSISTENCE
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Save personality data to NBT.
|
||||
|
||||
@@ -10,12 +10,9 @@ import net.minecraft.world.phys.Vec3;
|
||||
* Interface for AI controller callbacks to EntityDamsel.
|
||||
* Provides access to entity state and methods needed by AI systems.
|
||||
*
|
||||
* Phase 5: Created for DamselAIController component.
|
||||
*/
|
||||
public interface IAIHost {
|
||||
// ========================================
|
||||
// BASIC ENTITY ACCESS
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Get the entity's level/world.
|
||||
@@ -42,9 +39,7 @@ public interface IAIHost {
|
||||
*/
|
||||
AABB getBoundingBox();
|
||||
|
||||
// ========================================
|
||||
// LEASH SYSTEM ACCESS
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Check if entity is leashed.
|
||||
@@ -101,9 +96,7 @@ public interface IAIHost {
|
||||
*/
|
||||
double getZ();
|
||||
|
||||
// ========================================
|
||||
// COMPONENT ACCESS
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Get bondage manager component.
|
||||
@@ -115,9 +108,7 @@ public interface IAIHost {
|
||||
*/
|
||||
DamselPersonalitySystem getPersonalitySystem();
|
||||
|
||||
// ========================================
|
||||
// BONDAGE STATE QUERIES (delegated)
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Check if entity is tied up.
|
||||
|
||||
@@ -6,21 +6,16 @@ import net.minecraft.world.level.Level;
|
||||
* Interface for animation controller callbacks to EntityDamsel.
|
||||
* Provides access to entity state and methods needed by animation systems.
|
||||
*
|
||||
* Phase 3: Created for DamselAnimationController component.
|
||||
*/
|
||||
public interface IAnimationHost {
|
||||
// ========================================
|
||||
// LEVEL ACCESS
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Get the entity's level/world.
|
||||
*/
|
||||
Level level();
|
||||
|
||||
// ========================================
|
||||
// BODY ROTATION ACCESS
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Get current body rotation Y.
|
||||
@@ -42,9 +37,7 @@ public interface IAnimationHost {
|
||||
*/
|
||||
void setYBodyRotO(float rot);
|
||||
|
||||
// ========================================
|
||||
// POSE STATE QUERIES
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Check if entity is in "dog pose" (hogtied with armbinder).
|
||||
|
||||
@@ -13,7 +13,6 @@ import net.minecraft.world.level.Level;
|
||||
* This prevents circular dependencies while allowing the bondage component
|
||||
* to access necessary host entity functionality.
|
||||
*
|
||||
* Phase 7: Created for DamselBondageManager extraction.
|
||||
*/
|
||||
public interface IBondageHost {
|
||||
/**
|
||||
|
||||
@@ -9,7 +9,6 @@ import net.minecraft.world.phys.AABB;
|
||||
* Interface for dialogue handler callbacks to EntityDamsel.
|
||||
* Provides access to entity state and methods needed by dialogue systems.
|
||||
*
|
||||
* Phase 4: Created for DamselDialogueHandler component.
|
||||
*/
|
||||
public interface IDialogueHost {
|
||||
/**
|
||||
|
||||
@@ -13,7 +13,6 @@ import net.minecraft.world.phys.Vec3;
|
||||
* This prevents circular dependencies while allowing the personality component
|
||||
* to access necessary host entity functionality.
|
||||
*
|
||||
* Phase 6: Created for DamselPersonalitySystem extraction.
|
||||
*/
|
||||
public interface IPersonalityTickContext {
|
||||
/**
|
||||
|
||||
@@ -19,9 +19,7 @@ import net.minecraft.world.item.ItemStack;
|
||||
*/
|
||||
public class NpcCaptivityManager {
|
||||
|
||||
// ========================================
|
||||
// FIELDS
|
||||
// ========================================
|
||||
|
||||
private final AbstractTiedUpNpc entity;
|
||||
private final IBondageHost host;
|
||||
@@ -33,9 +31,7 @@ public class NpcCaptivityManager {
|
||||
/** Pending captor UUID for restoration after world load */
|
||||
private UUID pendingCaptorUUID;
|
||||
|
||||
// ========================================
|
||||
// CONSTRUCTOR
|
||||
// ========================================
|
||||
|
||||
public NpcCaptivityManager(
|
||||
AbstractTiedUpNpc entity,
|
||||
@@ -47,9 +43,7 @@ public class NpcCaptivityManager {
|
||||
this.equipment = equipment;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// CAPTIVITY STATE
|
||||
// ========================================
|
||||
|
||||
public boolean isCaptive() {
|
||||
return entity.isLeashed();
|
||||
@@ -72,9 +66,7 @@ public class NpcCaptivityManager {
|
||||
this.captor = null;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// CAPTURE LIFECYCLE
|
||||
// ========================================
|
||||
|
||||
public boolean getCapturedBy(ICaptor newCaptor) {
|
||||
if (newCaptor == null || !isEnslavable()) {
|
||||
@@ -191,9 +183,7 @@ public class NpcCaptivityManager {
|
||||
);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// POLE / LEASH
|
||||
// ========================================
|
||||
|
||||
public boolean isTiedToPole() {
|
||||
Entity leashHolder = entity.getLeashHolder();
|
||||
@@ -211,9 +201,7 @@ public class NpcCaptivityManager {
|
||||
return !isCaptive() && !equipment.hasCollar();
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// CAPTOR RESTORATION
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Attempt to restore captor from pending UUID.
|
||||
@@ -246,8 +234,7 @@ public class NpcCaptivityManager {
|
||||
.level()
|
||||
.players()) {
|
||||
if (player.getUUID().equals(pendingCaptorUUID)) {
|
||||
PlayerBindState bindState =
|
||||
PlayerBindState.getInstance(player);
|
||||
PlayerBindState bindState = PlayerBindState.getInstance(player);
|
||||
if (bindState != null) {
|
||||
ICaptor kidnapper = bindState.getCaptorManager();
|
||||
if (kidnapper != null) {
|
||||
@@ -266,9 +253,7 @@ public class NpcCaptivityManager {
|
||||
}
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// PERSISTENCE
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Save captivity-related state to NBT.
|
||||
@@ -291,9 +276,7 @@ public class NpcCaptivityManager {
|
||||
}
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// INTERNAL
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Get the facade IRestrainable reference for canCapture() calls.
|
||||
|
||||
@@ -28,36 +28,37 @@ import net.minecraft.world.item.ItemStack;
|
||||
*/
|
||||
public class NpcEquipmentManager {
|
||||
|
||||
// ========================================
|
||||
// FIELDS
|
||||
// ========================================
|
||||
|
||||
private final AbstractTiedUpNpc entity;
|
||||
private final IBondageHost host;
|
||||
|
||||
/** Maps legacy V1 NBT key names to V2 body regions for migration. */
|
||||
static final Map<String, BodyRegionV2> V1_TO_V2 = Map.of(
|
||||
"Bind", BodyRegionV2.ARMS,
|
||||
"Gag", BodyRegionV2.MOUTH,
|
||||
"Blindfold", BodyRegionV2.EYES,
|
||||
"Earplugs", BodyRegionV2.EARS,
|
||||
"Collar", BodyRegionV2.NECK,
|
||||
"Clothes", BodyRegionV2.TORSO,
|
||||
"Mittens", BodyRegionV2.HANDS
|
||||
"Bind",
|
||||
BodyRegionV2.ARMS,
|
||||
"Gag",
|
||||
BodyRegionV2.MOUTH,
|
||||
"Blindfold",
|
||||
BodyRegionV2.EYES,
|
||||
"Earplugs",
|
||||
BodyRegionV2.EARS,
|
||||
"Collar",
|
||||
BodyRegionV2.NECK,
|
||||
"Clothes",
|
||||
BodyRegionV2.TORSO,
|
||||
"Mittens",
|
||||
BodyRegionV2.HANDS
|
||||
);
|
||||
|
||||
// ========================================
|
||||
// CONSTRUCTOR
|
||||
// ========================================
|
||||
|
||||
public NpcEquipmentManager(AbstractTiedUpNpc entity, IBondageHost host) {
|
||||
this.entity = entity;
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// V2 EQUIPMENT HELPERS
|
||||
// ========================================
|
||||
|
||||
/** Get the V2 equipment storage from the parent entity, cast to concrete type. */
|
||||
V2BondageEquipment getEquipment() {
|
||||
@@ -74,9 +75,7 @@ public class NpcEquipmentManager {
|
||||
entity.syncV2Equipment();
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// STATE QUERIES (14 methods)
|
||||
// ========================================
|
||||
|
||||
public boolean isTiedUp() {
|
||||
return getEquipment().isRegionOccupied(BodyRegionV2.ARMS);
|
||||
@@ -152,9 +151,7 @@ public class NpcEquipmentManager {
|
||||
return collar.hasCustomHoverName();
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// EQUIPMENT GETTERS (7 methods)
|
||||
// ========================================
|
||||
|
||||
public ItemStack getCurrentBind() {
|
||||
return getEquipment().getInRegion(BodyRegionV2.ARMS);
|
||||
@@ -184,9 +181,7 @@ public class NpcEquipmentManager {
|
||||
return getEquipment().getInRegion(BodyRegionV2.HANDS);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// EQUIPMENT PUTTERS (7 methods)
|
||||
// ========================================
|
||||
|
||||
public void putBindOn(ItemStack bind) {
|
||||
if (bind.isEmpty()) return;
|
||||
@@ -217,10 +212,7 @@ public class NpcEquipmentManager {
|
||||
);
|
||||
}
|
||||
|
||||
TiedUpMod.LOGGER.debug(
|
||||
"[EntityDamsel] {} tied up",
|
||||
host.getNpcName()
|
||||
);
|
||||
TiedUpMod.LOGGER.debug("[EntityDamsel] {} tied up", host.getNpcName());
|
||||
}
|
||||
|
||||
public void putGagOn(ItemStack gag) {
|
||||
@@ -233,10 +225,7 @@ public class NpcEquipmentManager {
|
||||
bondageItem.onEquipped(gag, entity);
|
||||
}
|
||||
|
||||
TiedUpMod.LOGGER.debug(
|
||||
"[EntityDamsel] {} gagged",
|
||||
host.getNpcName()
|
||||
);
|
||||
TiedUpMod.LOGGER.debug("[EntityDamsel] {} gagged", host.getNpcName());
|
||||
}
|
||||
|
||||
public void putBlindfoldOn(ItemStack blindfold) {
|
||||
@@ -284,10 +273,7 @@ public class NpcEquipmentManager {
|
||||
// Play lock sound
|
||||
TiedUpSounds.playLockSound(entity);
|
||||
|
||||
TiedUpMod.LOGGER.debug(
|
||||
"[EntityDamsel] {} collared",
|
||||
host.getNpcName()
|
||||
);
|
||||
TiedUpMod.LOGGER.debug("[EntityDamsel] {} collared", host.getNpcName());
|
||||
}
|
||||
|
||||
public void putClothesOn(ItemStack clothes) {
|
||||
@@ -322,9 +308,7 @@ public class NpcEquipmentManager {
|
||||
);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// EQUIPMENT REMOVERS (8 methods + 1 force-remove)
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Force-remove the item from a region, bypassing ILockable lock checks.
|
||||
@@ -353,7 +337,10 @@ public class NpcEquipmentManager {
|
||||
// Region-specific side effects
|
||||
if (region == BodyRegionV2.ARMS) {
|
||||
RestraintEffectUtils.removeBindSpeedReduction(entity);
|
||||
TiedUpMod.LOGGER.debug("[EntityDamsel] {} force-untied", host.getNpcName());
|
||||
TiedUpMod.LOGGER.debug(
|
||||
"[EntityDamsel] {} force-untied",
|
||||
host.getNpcName()
|
||||
);
|
||||
}
|
||||
|
||||
return current;
|
||||
@@ -381,10 +368,7 @@ public class NpcEquipmentManager {
|
||||
// Remove speed reduction
|
||||
RestraintEffectUtils.removeBindSpeedReduction(entity);
|
||||
|
||||
TiedUpMod.LOGGER.debug(
|
||||
"[EntityDamsel] {} untied",
|
||||
host.getNpcName()
|
||||
);
|
||||
TiedUpMod.LOGGER.debug("[EntityDamsel] {} untied", host.getNpcName());
|
||||
|
||||
return current;
|
||||
}
|
||||
@@ -516,9 +500,7 @@ public class NpcEquipmentManager {
|
||||
return current;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// EQUIPMENT REPLACERS (14 methods)
|
||||
// ========================================
|
||||
|
||||
public ItemStack replaceBind(ItemStack newBind) {
|
||||
ItemStack oldBind = takeBindOff();
|
||||
@@ -572,7 +554,9 @@ public class NpcEquipmentManager {
|
||||
if (!oldBlindfold.isEmpty() || !newBlindfold.isEmpty()) {
|
||||
if (force && !oldBlindfold.isEmpty()) {
|
||||
getEquipment().setInRegion(BodyRegionV2.EYES, ItemStack.EMPTY);
|
||||
if (oldBlindfold.getItem() instanceof IV2BondageItem bondageItem) {
|
||||
if (
|
||||
oldBlindfold.getItem() instanceof IV2BondageItem bondageItem
|
||||
) {
|
||||
bondageItem.onUnequipped(oldBlindfold, entity);
|
||||
}
|
||||
}
|
||||
@@ -592,7 +576,9 @@ public class NpcEquipmentManager {
|
||||
if (!oldEarplugs.isEmpty() || !newEarplugs.isEmpty()) {
|
||||
if (force && !oldEarplugs.isEmpty()) {
|
||||
getEquipment().setInRegion(BodyRegionV2.EARS, ItemStack.EMPTY);
|
||||
if (oldEarplugs.getItem() instanceof IV2BondageItem bondageItem) {
|
||||
if (
|
||||
oldEarplugs.getItem() instanceof IV2BondageItem bondageItem
|
||||
) {
|
||||
bondageItem.onUnequipped(oldEarplugs, entity);
|
||||
}
|
||||
}
|
||||
@@ -634,7 +620,9 @@ public class NpcEquipmentManager {
|
||||
if (!oldMittens.isEmpty() || !newMittens.isEmpty()) {
|
||||
if (force && !oldMittens.isEmpty()) {
|
||||
getEquipment().setInRegion(BodyRegionV2.HANDS, ItemStack.EMPTY);
|
||||
if (oldMittens.getItem() instanceof IV2BondageItem bondageItem) {
|
||||
if (
|
||||
oldMittens.getItem() instanceof IV2BondageItem bondageItem
|
||||
) {
|
||||
bondageItem.onUnequipped(oldMittens, entity);
|
||||
}
|
||||
}
|
||||
@@ -643,9 +631,7 @@ public class NpcEquipmentManager {
|
||||
return oldMittens;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// BULK OPERATIONS
|
||||
// ========================================
|
||||
|
||||
public void applyBondage(
|
||||
ItemStack bind,
|
||||
@@ -738,24 +724,28 @@ public class NpcEquipmentManager {
|
||||
int count = 0;
|
||||
if (!getCurrentBind().isEmpty() && !isLocked(getCurrentBind())) count++;
|
||||
if (!getCurrentGag().isEmpty() && !isLocked(getCurrentGag())) count++;
|
||||
if (!getCurrentBlindfold().isEmpty() && !isLocked(getCurrentBlindfold())) count++;
|
||||
if (!getCurrentEarplugs().isEmpty() && !isLocked(getCurrentEarplugs())) count++;
|
||||
if (!getCurrentCollar().isEmpty() && !isLocked(getCurrentCollar())) count++;
|
||||
if (!getCurrentClothes().isEmpty() && !isLocked(getCurrentClothes())) count++;
|
||||
if (
|
||||
!getCurrentBlindfold().isEmpty() && !isLocked(getCurrentBlindfold())
|
||||
) count++;
|
||||
if (
|
||||
!getCurrentEarplugs().isEmpty() && !isLocked(getCurrentEarplugs())
|
||||
) count++;
|
||||
if (
|
||||
!getCurrentCollar().isEmpty() && !isLocked(getCurrentCollar())
|
||||
) count++;
|
||||
if (
|
||||
!getCurrentClothes().isEmpty() && !isLocked(getCurrentClothes())
|
||||
) count++;
|
||||
return count;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// ADVANCED QUERIES
|
||||
// ========================================
|
||||
|
||||
public boolean canBeTiedUp() {
|
||||
return !isTiedUp();
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// PERMISSIONS
|
||||
// ========================================
|
||||
|
||||
public boolean canTakeOffClothes(Player player) {
|
||||
return true; // NPCs don't have permission restrictions
|
||||
@@ -769,9 +759,7 @@ public class NpcEquipmentManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// COLLAR OWNER CHECK
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Check if a player is an owner of this NPC's collar.
|
||||
@@ -784,9 +772,7 @@ public class NpcEquipmentManager {
|
||||
return collarItem.isOwner(collar, player);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// COERCION
|
||||
// ========================================
|
||||
|
||||
public void tighten(Player tightener) {
|
||||
if (!isTiedUp()) return;
|
||||
@@ -851,9 +837,7 @@ public class NpcEquipmentManager {
|
||||
}
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// INTERNAL - UNLOCK ALL
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Unlock all locked bondage items on this entity.
|
||||
@@ -862,8 +846,11 @@ public class NpcEquipmentManager {
|
||||
*/
|
||||
public void unlockAllItems() {
|
||||
BodyRegionV2[] regions = {
|
||||
BodyRegionV2.ARMS, BodyRegionV2.MOUTH, BodyRegionV2.EYES,
|
||||
BodyRegionV2.EARS, BodyRegionV2.NECK
|
||||
BodyRegionV2.ARMS,
|
||||
BodyRegionV2.MOUTH,
|
||||
BodyRegionV2.EYES,
|
||||
BodyRegionV2.EARS,
|
||||
BodyRegionV2.NECK,
|
||||
};
|
||||
boolean changed = false;
|
||||
for (BodyRegionV2 region : regions) {
|
||||
@@ -890,9 +877,7 @@ public class NpcEquipmentManager {
|
||||
syncToEntityData();
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// PERSISTENCE
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Save equipment-related state to NBT.
|
||||
@@ -914,7 +899,9 @@ public class NpcEquipmentManager {
|
||||
// Legacy V1 migration: load individual item keys into V2 regions
|
||||
for (Map.Entry<String, BodyRegionV2> entry : V1_TO_V2.entrySet()) {
|
||||
if (tag.contains(entry.getKey(), Tag.TAG_COMPOUND)) {
|
||||
ItemStack stack = ItemStack.of(tag.getCompound(entry.getKey()));
|
||||
ItemStack stack = ItemStack.of(
|
||||
tag.getCompound(entry.getKey())
|
||||
);
|
||||
if (!stack.isEmpty()) {
|
||||
getEquipment().setInRegion(entry.getValue(), stack);
|
||||
}
|
||||
@@ -924,9 +911,7 @@ public class NpcEquipmentManager {
|
||||
syncToEntityData();
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// PRIVATE HELPERS
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* Check if an item is locked (convenience -- no force parameter).
|
||||
|
||||
@@ -15,7 +15,6 @@ import net.minecraft.world.phys.Vec3;
|
||||
* Host implementation for AIController callbacks.
|
||||
* Extracted from EntityDamsel inner class for better organization.
|
||||
*
|
||||
* Phase 9: Extracted from EntityDamsel.AIHostImpl
|
||||
*/
|
||||
public class AIHost implements IAIHost {
|
||||
|
||||
@@ -25,9 +24,7 @@ public class AIHost implements IAIHost {
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// BASIC ENTITY ACCESS
|
||||
// ========================================
|
||||
|
||||
@Override
|
||||
public Level level() {
|
||||
@@ -54,9 +51,7 @@ public class AIHost implements IAIHost {
|
||||
return entity.getBoundingBox();
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// LEASH SYSTEM ACCESS
|
||||
// ========================================
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
@@ -113,9 +108,7 @@ public class AIHost implements IAIHost {
|
||||
return entity.getZ();
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// COMPONENT ACCESS
|
||||
// ========================================
|
||||
|
||||
@Override
|
||||
public DamselBondageManager getBondageManager() {
|
||||
@@ -127,9 +120,7 @@ public class AIHost implements IAIHost {
|
||||
return entity.getPersonalitySystem();
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// BONDAGE STATE QUERIES (delegated)
|
||||
// ========================================
|
||||
|
||||
@Override
|
||||
public boolean isTiedUp() {
|
||||
|
||||
@@ -8,8 +8,6 @@ import net.minecraft.world.level.Level;
|
||||
* Host implementation for AnimationController callbacks.
|
||||
* Extracted from EntityDamsel inner class for better organization.
|
||||
*
|
||||
* Phase 9: Extracted from EntityDamsel.AnimationHostImpl
|
||||
* Phase 3 audit: Updated to use AbstractTiedUpNpc
|
||||
*/
|
||||
public class AnimationHost implements IAnimationHost {
|
||||
|
||||
@@ -76,6 +74,8 @@ public class AnimationHost implements IAnimationHost {
|
||||
|
||||
@Override
|
||||
public void setStrugglingToData(boolean struggling) {
|
||||
entity.getEntityData().set(AbstractTiedUpNpc.DATA_STRUGGLING, struggling);
|
||||
entity
|
||||
.getEntityData()
|
||||
.set(AbstractTiedUpNpc.DATA_STRUGGLING, struggling);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import net.minecraft.world.level.Level;
|
||||
* Host implementation for BondageManager callbacks.
|
||||
* Extracted from EntityDamsel inner class for better organization.
|
||||
*
|
||||
* Phase 9: Extracted from EntityDamsel.BondageHostImpl
|
||||
*/
|
||||
public class BondageHost implements IBondageHost {
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import net.minecraft.world.phys.AABB;
|
||||
* Host implementation for DialogueHandler callbacks.
|
||||
* Extracted from EntityDamsel inner class for better organization.
|
||||
*
|
||||
* Phase 9: Extracted from EntityDamsel.DialogueHostImpl
|
||||
*/
|
||||
public class DialogueHost implements IDialogueHost {
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.tiedup.remake.entities.damsel.hosts;
|
||||
|
||||
import com.tiedup.remake.dialogue.EntityDialogueManager;
|
||||
import com.tiedup.remake.v2.BodyRegionV2;
|
||||
import com.tiedup.remake.entities.EntityDamsel;
|
||||
import com.tiedup.remake.entities.damsel.components.DamselAppearance;
|
||||
import com.tiedup.remake.entities.damsel.components.DamselBondageManager;
|
||||
import com.tiedup.remake.entities.damsel.components.DamselInventoryManager;
|
||||
import com.tiedup.remake.entities.damsel.components.IPersonalityTickContext;
|
||||
import com.tiedup.remake.v2.BodyRegionV2;
|
||||
import java.util.UUID;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
@@ -19,7 +19,6 @@ import net.minecraft.world.phys.Vec3;
|
||||
* Host implementation for PersonalitySystem callbacks.
|
||||
* Extracted from EntityDamsel inner class for better organization.
|
||||
*
|
||||
* Phase 9: Extracted from EntityDamsel.PersonalityTickContextImpl
|
||||
*/
|
||||
public class PersonalityTickContextHost implements IPersonalityTickContext {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user