package com.tiedup.remake.state; import net.minecraft.world.entity.Entity; import org.jetbrains.annotations.Nullable; /** * Capture, leash, and transport interface for kidnapped entities. * *

Covers the capture lifecycle: being captured by a captor, being freed, * being transferred to another captor, and querying capture state.

* * @see IRestrainableEntity * @see IBondageState * @see IRestrainable */ public interface ICapturable extends IRestrainableEntity { // CAPTURE LIFECYCLE /** * Capture this entity by the given captor. * *

Prerequisites:

* * *

Process for Players:

*
    *
  1. Validate conditions (tied up or has owner's collar)
  2. *
  3. Transfer any existing captives to new captor (if allowed)
  4. *
  5. Create LeashProxyEntity that follows the player
  6. *
  7. Attach leash from proxy to captor entity
  8. *
  9. Add captive to captor's captive list
  10. *
* *

Process for NPCs:

*
    *
  1. Validate conditions
  2. *
  3. Use vanilla setLeashedTo() directly on the NPC
  4. *
* * * @param captor The captor attempting to capture * @return true if capture succeeded, false otherwise */ boolean getCapturedBy(ICaptor captor); /** * Free this captive from capture. * Equivalent to {@code free(true)}. * *

This will:

* */ void free(); /** * Free this captive from capture with transport state option. * * @param transportState If true, despawn the transport entity. If false, keep it (for transfer). */ void free(boolean transportState); /** * Transfer this captive to a new captor. * Current captor loses the captive, new captor gains it. * *

Only works if current captor allows captive transfer * ({@link ICaptor#allowCaptiveTransfer()} == true).

* * * @param newCaptor The new captor to transfer to */ void transferCaptivityTo(ICaptor newCaptor); // STATE QUERIES - CAPTURE /** * Check if this entity can be captured. * *

From original code (PlayerBindState.java:195-225):

* * * @return true if capturable */ boolean isEnslavable(); /** * Check if this entity is currently captured (attached by leash). * *

For Players: Returns true when LeashProxyEntity is attached and leashed to captor

*

For NPCs: Returns true when vanilla leash is attached

* * * @return true if captured (has leash holder) */ boolean isCaptive(); /** * Check if this entity can be tied up (not already restrained). * * @return true if entity can accept bind items */ boolean canBeTiedUp(); /** * Check if this entity is tied to a pole (immobilized). * * @return true if tied to a static pole entity */ boolean isTiedToPole(); /** * Tie this entity to the closest fence/pole within range. * Searches for fence blocks near the entity's current position. * * @param searchRadius The radius in blocks to search for fences * @return true if successfully tied to a pole */ boolean tieToClosestPole(int searchRadius); /** * Check if this entity can be auto-kidnapped by events. * Used by EntityKidnapper AI to determine valid targets. * * @return true if can be targeted by kidnapping events */ boolean canBeKidnappedByEvents(); /** * Get the current captor (the entity holding the leash). * * * @return The captor, or null if not captured */ ICaptor getCaptor(); /** * Get the leash proxy or transport entity for this captive. * *

For Players: Returns the LeashProxyEntity following the player

*

For NPCs: Returns null (NPCs use vanilla leash directly)

* * @return The proxy/transport entity, or null if not applicable */ @Nullable Entity getTransport(); }