feat(D-01/C): consumer migration — 85 files migrated to V2 helpers

Phase 1 (state): PlayerBindState, PlayerCaptorManager, PlayerEquipment,
  PlayerDataRetrieval, PlayerLifecycle, PlayerShockCollar, StruggleAccessory
Phase 2 (client): AnimationTickHandler, NpcAnimationTickHandler, 5 render
  handlers, DamselModel, 3 client mixins, SelfBondageInputHandler,
  SlaveManagementScreen, ActionPanel, SlaveEntryWidget, ModKeybindings
Phase 3 (entities): 28 entity/AI files migrated to CollarHelper,
  BindModeHelper, PoseTypeHelper, createStack()
Phase 4 (network): PacketSlaveAction, PacketMasterEquip,
  PacketAssignCellToCollar, PacketNpcCommand, PacketFurnitureForcemount
Phase 5 (events): RestraintTaskTickHandler, PetPlayRestrictionHandler,
  PlayerEnslavementHandler, ChatEventHandler, LaborAttackPunishmentHandler
Phase 6 (commands): BondageSubCommand, CollarCommand, NPCCommand,
  KidnapSetCommand
Phase 7 (compat): MCAKidnappedAdapter, MCA mixins
Phase 8 (misc): GagTalkManager, PetRequestManager, HangingCagePiece,
  BondageItemBlockEntity, TrappedChestBlockEntity, DispenserBehaviors,
  BondageItemLoaderUtility, RestraintApplicator, StruggleSessionManager,
  MovementStyleResolver, CampLifecycleManager

Some files retain dual V1/V2 checks (instanceof V1 || V2Helper) for
coexistence — V1-only branches removed in Branch D.
This commit is contained in:
NotEvil
2026-04-15 00:16:50 +02:00
parent 52d1044e9a
commit 3d61c9e9e6
85 changed files with 2885 additions and 777 deletions

View File

@@ -5,8 +5,8 @@ import com.tiedup.remake.cells.CellRegistryV2;
import com.tiedup.remake.core.SystemMessageManager;
import com.tiedup.remake.core.TiedUpMod;
import com.tiedup.remake.entities.EntityDamsel;
import com.tiedup.remake.items.base.ItemCollar;
import com.tiedup.remake.network.PacketRateLimiter;
import com.tiedup.remake.v2.bondage.CollarHelper;
import com.tiedup.remake.network.sync.SyncManager;
import com.tiedup.remake.personality.PersonalityState;
import com.tiedup.remake.state.IBondageState;
@@ -14,9 +14,9 @@ import com.tiedup.remake.util.KidnappedHelper;
import com.tiedup.remake.v2.BodyRegionV2;
import java.util.UUID;
import java.util.function.Supplier;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
@@ -96,7 +96,7 @@ public class PacketAssignCellToCollar {
}
ItemStack collarStack = state.getEquipment(BodyRegionV2.NECK);
if (!(collarStack.getItem() instanceof ItemCollar collar)) {
if (!CollarHelper.isCollar(collarStack)) {
TiedUpMod.LOGGER.debug(
"[PacketAssignCellToCollar] Invalid collar item"
);
@@ -105,7 +105,7 @@ public class PacketAssignCellToCollar {
// Security: Verify sender owns the collar (or is admin)
if (
!collar.isOwner(collarStack, sender) &&
!CollarHelper.isOwner(collarStack, sender) &&
!sender.hasPermissions(2)
) {
TiedUpMod.LOGGER.debug(
@@ -139,7 +139,15 @@ public class PacketAssignCellToCollar {
}
// Set the cell ID on the collar
collar.setCellId(collarStack, msg.cellId);
if (msg.cellId != null) {
CollarHelper.setCellId(collarStack, msg.cellId);
} else {
// Clear cell assignment
CompoundTag collarTag = collarStack.getTag();
if (collarTag != null) {
collarTag.remove("cellId");
}
}
// Sync PersonalityState for damsels
if (target instanceof EntityDamsel damsel) {

View File

@@ -7,8 +7,8 @@ import com.tiedup.remake.dialogue.EntityDialogueManager.DialogueCategory;
import com.tiedup.remake.entities.EntityDamsel;
import com.tiedup.remake.items.ItemCommandWand;
import com.tiedup.remake.items.ModItems;
import com.tiedup.remake.items.base.ItemCollar;
import com.tiedup.remake.network.ModNetwork;
import com.tiedup.remake.v2.bondage.CollarHelper;
import com.tiedup.remake.network.PacketRateLimiter;
import com.tiedup.remake.personality.JobExperience;
import com.tiedup.remake.personality.NpcCommand;
@@ -390,11 +390,11 @@ public class PacketNpcCommand {
}
ItemStack collar = damsel.getEquipment(BodyRegionV2.NECK);
if (!(collar.getItem() instanceof ItemCollar collarItem)) {
if (!CollarHelper.isCollar(collar)) {
return false;
}
if (!collarItem.getOwners(collar).contains(sender.getUUID())) {
if (!CollarHelper.isOwner(collar, sender)) {
SystemMessageManager.sendToPlayer(
sender,
SystemMessageManager.MessageCategory.ERROR,

View File

@@ -1,7 +1,7 @@
package com.tiedup.remake.network.slave;
import com.tiedup.remake.items.base.ItemCollar;
import com.tiedup.remake.network.PacketRateLimiter;
import com.tiedup.remake.v2.bondage.CollarHelper;
import com.tiedup.remake.state.IBondageState;
import com.tiedup.remake.util.KidnappedHelper;
import com.tiedup.remake.v2.BodyRegionV2;
@@ -75,9 +75,9 @@ public class PacketMasterEquip {
);
if (targetState == null || !targetState.hasCollar()) return;
ItemStack collarStack = targetState.getEquipment(BodyRegionV2.NECK);
if (collarStack.getItem() instanceof ItemCollar collar) {
if (CollarHelper.isCollar(collarStack)) {
if (
!collar.isOwner(collarStack, sender) &&
!CollarHelper.isOwner(collarStack, sender) &&
!sender.hasPermissions(2)
) return;
}

View File

@@ -2,10 +2,8 @@ package com.tiedup.remake.network.slave;
import com.tiedup.remake.core.SystemMessageManager;
import com.tiedup.remake.core.TiedUpMod;
import com.tiedup.remake.items.ItemGpsCollar;
import com.tiedup.remake.items.ItemShockCollar;
import com.tiedup.remake.items.base.ItemCollar;
import com.tiedup.remake.state.IBondageState;
import com.tiedup.remake.v2.bondage.CollarHelper;
import com.tiedup.remake.state.IRestrainable;
import com.tiedup.remake.state.PlayerBindState;
import com.tiedup.remake.state.PlayerCaptorManager;
@@ -128,8 +126,8 @@ public class PacketSlaveAction {
ItemStack collarStack = kidnapped.getEquipment(
BodyRegionV2.NECK
);
if (collarStack.getItem() instanceof ItemCollar collar) {
if (collar.isOwner(collarStack, sender)) {
if (CollarHelper.isCollar(collarStack)) {
if (CollarHelper.isOwner(collarStack, sender)) {
targetCaptive = kidnapped;
break;
}
@@ -219,10 +217,7 @@ public class PacketSlaveAction {
}
ItemStack collarStack = target.getEquipment(BodyRegionV2.NECK);
if (
!(collarStack.getItem() instanceof ItemCollar collar) ||
!collar.canShock()
) {
if (!CollarHelper.canShock(collarStack)) {
SystemMessageManager.sendToPlayer(
sender,
SystemMessageManager.MessageCategory.ERROR,
@@ -232,14 +227,8 @@ public class PacketSlaveAction {
}
// Check if sender is owner of the collar or collar is public
// FIX: Always check permissions for ANY collar that can shock, not just ItemShockCollar
boolean isOwner = collar.isOwner(collarStack, sender);
boolean isPublic = false;
// ItemShockCollar has additional "public mode" that allows anyone to shock
if (collarStack.getItem() instanceof ItemShockCollar shockCollar) {
isPublic = shockCollar.isPublic(collarStack);
}
boolean isOwner = CollarHelper.isOwner(collarStack, sender);
boolean isPublic = CollarHelper.isPublicShock(collarStack);
if (!isOwner && !isPublic) {
SystemMessageManager.sendToPlayer(
@@ -285,10 +274,7 @@ public class PacketSlaveAction {
}
ItemStack collarStack = target.getEquipment(BodyRegionV2.NECK);
if (
!(collarStack.getItem() instanceof ItemCollar collar) ||
!collar.hasGPS()
) {
if (!CollarHelper.hasGPS(collarStack)) {
SystemMessageManager.sendToPlayer(
sender,
SystemMessageManager.MessageCategory.ERROR,
@@ -298,18 +284,16 @@ public class PacketSlaveAction {
}
// Check permissions
if (collarStack.getItem() instanceof ItemGpsCollar gpsCollar) {
boolean isOwner = collar.isOwner(collarStack, sender);
boolean isPublic = gpsCollar.hasPublicTracking(collarStack);
boolean isOwner = CollarHelper.isOwner(collarStack, sender);
boolean isPublic = CollarHelper.hasPublicTracking(collarStack);
if (!isOwner && !isPublic) {
SystemMessageManager.sendToPlayer(
sender,
SystemMessageManager.MessageCategory.ERROR,
"You don't have permission to track " + name + "!"
);
return;
}
if (!isOwner && !isPublic) {
SystemMessageManager.sendToPlayer(
sender,
SystemMessageManager.MessageCategory.ERROR,
"You don't have permission to track " + name + "!"
);
return;
}
// Check same dimension
@@ -367,8 +351,8 @@ public class PacketSlaveAction {
} else {
// For collar-owned entities, just remove collar ownership
ItemStack collarStack = target.getEquipment(BodyRegionV2.NECK);
if (collarStack.getItem() instanceof ItemCollar collar) {
collar.removeOwner(collarStack, sender.getUUID());
if (CollarHelper.isCollar(collarStack)) {
CollarHelper.removeOwner(collarStack, sender.getUUID());
SystemMessageManager.sendToPlayer(
sender,
"Released collar control of " + name + "!",