Files
TiedUp-/src/main/java/com/tiedup/remake/entities/KidnapperCaptureEquipment.java
NotEvil 2504b7d657 feat(D-01/D): V1 cleanup — delete 28 files, ~5400 lines removed
D1: ThreadLocal alert suppression moved from ItemCollar to CollarHelper.
    onCollarRemoved() logic (kidnapper alert) moved to CollarHelper.

D2+D3: Deleted 17 V1 item classes + 4 V1-only interfaces:
  ItemBind, ItemGag, ItemBlindfold, ItemCollar, ItemEarplugs, ItemMittens,
  ItemColor, ItemClassicCollar, ItemShockCollar, ItemShockCollarAuto,
  ItemGpsCollar, ItemChokeCollar, ItemHood, ItemMedicalGag,
  IBondageItem, IHasGaggingEffect, IHasBlindingEffect, IAdjustable

D4: KidnapperTheme/KidnapperItemSelector/DispenserBehaviors migrated
    from variant enums to string-based DataDrivenItemRegistry IDs.

D5: Deleted 11 variant enums + Generic* factories + ItemBallGag3D:
  BindVariant, GagVariant, BlindfoldVariant, EarplugsVariant, MittensVariant,
  GenericBind, GenericGag, GenericBlindfold, GenericEarplugs, GenericMittens

D6: ModItems cleaned — all V1 bondage registrations removed.
D7: ModCreativeTabs rewritten — iterates DataDrivenItemRegistry.
D8+D9: All V2 helpers cleaned (V1 fallbacks removed), orphan imports removed.

Zero V1 bondage code references remain (only Javadoc comments).
All bondage items are now data-driven via 47 JSON definitions.
2026-04-15 01:55:16 +02:00

159 lines
5.0 KiB
Java

package com.tiedup.remake.entities;
import com.tiedup.remake.items.ModItems;
import com.tiedup.remake.v2.bondage.datadriven.DataDrivenBondageItem;
import net.minecraft.resources.ResourceLocation;
import com.tiedup.remake.v2.bondage.IV2BondageItem;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.Nullable;
/**
* Manages capture equipment for EntityKidnapper.
*
* <p>Handles the themed bondage items used during capture sequences:
* <ul>
* <li>Bind (always) - Main hand during capture</li>
* <li>Gag (probability) - Off hand during capture</li>
* <li>Mittens, Earplugs, Blindfold (probability) - Applied after capture</li>
* </ul>
*
* <p>The theme and items are selected at spawn via {@link KidnapperItemSelector}
* and stored in the kidnapper's {@code itemSelection} field.
*
* <p>Note: This class does NOT handle persistence - the theme is persisted
* by EntityKidnapper directly.
*/
public class KidnapperCaptureEquipment {
protected final EntityKidnapper kidnapper;
public KidnapperCaptureEquipment(EntityKidnapper kidnapper) {
this.kidnapper = kidnapper;
}
// ITEM GETTERS
/**
* Get bind item to use for capture.
* Uses held item if valid, otherwise default ropes.
*
* @return The bind ItemStack to use (never null/empty)
*/
public ItemStack getBindItem() {
ItemStack mainHand = kidnapper.getMainHandItem();
if (
!mainHand.isEmpty() && mainHand.getItem() instanceof IV2BondageItem
) {
return mainHand;
}
return DataDrivenBondageItem.createStack(new ResourceLocation("tiedup", "ropes"));
}
/**
* Get gag item to use for capture.
* Uses offhand item if valid, otherwise empty (no gag).
*
* @return The gag ItemStack, or empty if no gag selected
*/
public ItemStack getGagItem() {
ItemStack offHand = kidnapper.getOffhandItem();
if (!offHand.isEmpty() && offHand.getItem() instanceof IV2BondageItem) {
return offHand;
}
return ItemStack.EMPTY;
}
/**
* Get mittens item to apply after capture.
*
* @return The mittens ItemStack, or null if not selected
*/
@Nullable
public ItemStack getMittensItem() {
var selection = kidnapper.getItemSelection();
if (selection != null && !selection.mittens.isEmpty()) {
return selection.mittens.copy();
}
return null;
}
/**
* Get earplugs item to apply after capture.
*
* @return The earplugs ItemStack, or null if not selected
*/
@Nullable
public ItemStack getEarplugsItem() {
var selection = kidnapper.getItemSelection();
if (selection != null && !selection.earplugs.isEmpty()) {
return selection.earplugs.copy();
}
return null;
}
/**
* Get blindfold item to apply after capture.
*
* @return The blindfold ItemStack, or null if not selected
*/
@Nullable
public ItemStack getBlindfoldItem() {
var selection = kidnapper.getItemSelection();
if (selection != null && !selection.blindfold.isEmpty()) {
return selection.blindfold.copy();
}
return null;
}
/**
* Get collar item to apply during capture.
* Returns a basic shock collar that kidnappers use.
*
* @return The collar ItemStack, or null if not available
*/
@Nullable
public ItemStack getCollarItem() {
// Kidnappers always have a shock collar to mark their captives
return com.tiedup.remake.v2.bondage.datadriven.DataDrivenBondageItem.createStack(
new net.minecraft.resources.ResourceLocation("tiedup", "shock_collar"));
}
// HELD ITEM MANAGEMENT
/**
* Equip themed bind and gag items before capture.
* Called when starting to chase a target.
*
* <p>This makes the kidnapper visually hold their capture tools.
*/
public void setUpHeldItems() {
// Initialize theme if not done yet
var selection = kidnapper.getItemSelection();
if (selection == null) {
kidnapper.ensureAppearanceInitialized();
selection = kidnapper.getItemSelection();
}
// Equip bind in main hand (always present)
kidnapper.setItemSlot(EquipmentSlot.MAINHAND, selection.bind.copy());
// Equip gag in off hand (if selected)
if (!selection.gag.isEmpty()) {
kidnapper.setItemSlot(EquipmentSlot.OFFHAND, selection.gag.copy());
}
}
/**
* Clear held items (hide capture tools).
* Called when not chasing anyone.
*
* <p>Note: Subclasses may override this to restore different items
* (e.g., Archer restores bow, Merchant may have different behavior).
*/
public void clearHeldItems() {
kidnapper.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY);
kidnapper.setItemSlot(EquipmentSlot.OFFHAND, ItemStack.EMPTY);
}
}