feature/d01-branch-d-cleanup #9

Merged
NotEvil merged 6 commits from feature/d01-branch-d-cleanup into develop 2026-04-15 00:54:12 +00:00
Showing only changes of commit 75cf1358f9 - Show all commits

View File

@@ -208,75 +208,4 @@ public class PacketSelfBondage {
}
}
/**
* Handle self-equipping an accessory (gag, blindfold, mittens, earplugs).
* Can be used anytime (no need to be tied).
* Blocked only if arms are fully bound.
* Supports swapping: if same type already equipped (and not locked), swap them.
*/
private static void handleSelfAccessory(
ServerPlayer player,
ItemStack stack,
IBondageState state,
String itemType,
java.util.function.Predicate<IBondageState> isEquipped,
java.util.function.Function<IBondageState, ItemStack> getCurrent,
java.util.function.Function<IBondageState, ItemStack> takeOff,
java.util.function.BiConsumer<IBondageState, ItemStack> putOn
) {
// Can't equip if arms are fully bound (need hands to put on accessories)
ItemStack currentBind = state.getEquipment(BodyRegionV2.ARMS);
if (!currentBind.isEmpty()) {
if (BindModeHelper.hasArmsBound(currentBind)) {
TiedUpMod.LOGGER.debug(
"[SelfBondage] {} can't self-{} - arms are bound",
player.getName().getString(),
itemType
);
return;
}
}
// Already equipped? Try to swap
if (isEquipped.test(state)) {
ItemStack currentItem = getCurrent.apply(state);
// Check if current item is locked
if (
currentItem.getItem() instanceof ILockable lockable &&
lockable.isLocked(currentItem)
) {
TiedUpMod.LOGGER.debug(
"[SelfBondage] {} can't swap {} - current is locked",
player.getName().getString(),
itemType
);
return;
}
// Remove current and drop it
ItemStack removed = takeOff.apply(state);
if (!removed.isEmpty()) {
state.kidnappedDropItem(removed);
TiedUpMod.LOGGER.debug(
"[SelfBondage] {} swapping {} - dropped old one",
player.getName().getString(),
itemType
);
}
}
// Equip new item on self
putOn.accept(state, stack.copy());
stack.shrink(1);
// Sync to client
SyncManager.syncInventory(player);
TiedUpMod.LOGGER.info(
"[SelfBondage] {} self-equipped {}",
player.getName().getString(),
itemType
);
}
}