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.
This commit is contained in:
NotEvil
2026-04-15 01:55:16 +02:00
parent fccb99ef9a
commit 099cd0d984
89 changed files with 2647 additions and 5423 deletions

View File

@@ -4,12 +4,14 @@ import com.tiedup.remake.core.ModSounds;
import com.tiedup.remake.core.SystemMessageManager;
import com.tiedup.remake.core.SystemMessageManager.MessageCategory;
import com.tiedup.remake.core.TiedUpMod;
import com.tiedup.remake.items.ItemGpsCollar;
import com.tiedup.remake.items.ItemShockCollarAuto;
import com.tiedup.remake.state.hosts.IPlayerBindStateHost;
import com.tiedup.remake.util.GameConstants;
import com.tiedup.remake.util.time.Timer;
import com.tiedup.remake.v2.BodyRegionV2;
import com.tiedup.remake.v2.bondage.CollarHelper;
import com.tiedup.remake.v2.bondage.component.ComponentType;
import com.tiedup.remake.v2.bondage.component.GpsComponent;
import com.tiedup.remake.v2.bondage.datadriven.DataDrivenBondageItem;
import java.util.List;
import java.util.UUID;
import net.minecraft.ChatFormatting;
@@ -128,17 +130,16 @@ public class PlayerShockCollar {
// Flags set inside lock, actions performed outside
boolean shouldShockAuto = false;
boolean shouldShockGPS = false;
ItemGpsCollar gpsCollar = null;
ItemStack gpsStack = null;
ItemStack gpsStackCopy = null;
synchronized (lockTimerAutoShock) {
ItemStack collarStack = getCurrentCollar();
if (collarStack.isEmpty()) return;
// Auto-Shock Collar handling
if (
collarStack.getItem() instanceof ItemShockCollarAuto collarShock
) {
// Auto-Shock Collar handling: collar can shock AND has auto interval > 0
if (CollarHelper.canShock(collarStack) && CollarHelper.getShockInterval(collarStack) > 0) {
int interval = CollarHelper.getShockInterval(collarStack);
if (
timerAutoShockCollar != null &&
timerAutoShockCollar.isExpired()
@@ -151,40 +152,38 @@ public class PlayerShockCollar {
timerAutoShockCollar.isExpired()
) {
timerAutoShockCollar = new Timer(
collarShock.getInterval() /
GameConstants.TICKS_PER_SECOND,
interval / GameConstants.TICKS_PER_SECOND,
player.level()
);
}
}
// GPS Collar handling
else if (collarStack.getItem() instanceof ItemGpsCollar gps) {
else if (CollarHelper.hasGPS(collarStack)) {
if (
gps.isActive(collarStack) &&
CollarHelper.isActive(collarStack) &&
(timerAutoShockCollar == null ||
timerAutoShockCollar.isExpired())
) {
List<ItemGpsCollar.SafeSpot> safeSpots = gps.getSafeSpots(
collarStack
GpsComponent gpsComp = DataDrivenBondageItem.getComponent(
collarStack, ComponentType.GPS, GpsComponent.class
);
if (safeSpots != null && !safeSpots.isEmpty()) {
boolean isSafe = false;
for (ItemGpsCollar.SafeSpot spot : safeSpots) {
if (spot.isInside(player)) {
isSafe = true;
break;
}
}
if (!isSafe) {
timerAutoShockCollar = new Timer(
gps.getShockInterval(collarStack) /
GameConstants.TICKS_PER_SECOND,
player.level()
);
shouldShockGPS = true;
gpsCollar = gps;
gpsStack = collarStack.copy();
}
int safeZoneRadius = gpsComp != null ? gpsComp.getSafeZoneRadius() : 50;
// Shock interval from ShockComponent (GPS collars also have shock capability)
int shockInterval = CollarHelper.getShockInterval(collarStack);
if (shockInterval <= 0) shockInterval = 100; // Fallback: 5 seconds
// Check safe spots from NBT (CollarHelper reads "safeSpots" NBT)
// For now, use safeZoneRadius from GpsComponent
// GPS safe zone check: if the collar has safe spots in NBT, check them
boolean isSafe = isInSafeZone(collarStack, player, safeZoneRadius);
if (!isSafe) {
timerAutoShockCollar = new Timer(
shockInterval / GameConstants.TICKS_PER_SECOND,
player.level()
);
shouldShockGPS = true;
gpsStackCopy = collarStack.copy();
}
}
}
@@ -195,30 +194,58 @@ public class PlayerShockCollar {
this.shockKidnapped();
}
if (shouldShockGPS && gpsCollar != null) {
if (shouldShockGPS && gpsStackCopy != null) {
this.shockKidnapped(
" Return back to your allowed area!",
GameConstants.DEFAULT_SHOCK_DAMAGE
);
warnOwnersGPSViolation(gpsCollar, gpsStack);
warnOwnersGPSViolation(gpsStackCopy);
}
}
/**
* Check if the player is inside any safe zone defined on the collar.
* Reads safe spots from NBT "safeSpots" ListTag.
*/
private boolean isInSafeZone(ItemStack collarStack, Player player, int defaultRadius) {
net.minecraft.nbt.CompoundTag tag = collarStack.getTag();
if (tag == null || !tag.contains("safeSpots", net.minecraft.nbt.Tag.TAG_LIST)) {
return true; // No safe spots defined = always safe
}
net.minecraft.nbt.ListTag safeSpots = tag.getList("safeSpots", net.minecraft.nbt.Tag.TAG_COMPOUND);
if (safeSpots.isEmpty()) return true;
for (int i = 0; i < safeSpots.size(); i++) {
net.minecraft.nbt.CompoundTag spot = safeSpots.getCompound(i);
double x = spot.getDouble("x");
double y = spot.getDouble("y");
double z = spot.getDouble("z");
int radius = spot.contains("radius") ? spot.getInt("radius") : defaultRadius;
double dist = player.distanceToSqr(x, y, z);
if (dist <= (double) radius * radius) {
return true;
}
}
return false;
}
/**
* Sends a global alert to masters when a slave violates their GPS zone.
* Private helper method.
*/
private void warnOwnersGPSViolation(ItemGpsCollar gps, ItemStack stack) {
private void warnOwnersGPSViolation(ItemStack stack) {
Player player = host.getPlayer();
if (player.getServer() == null) return;
if (!CollarHelper.shouldWarnMasters(stack)) return;
// Format: "ALERT: <player name> is outside the safe zone!"
String alertMessage = String.format(
SystemMessageManager.getTemplate(MessageCategory.GPS_OWNER_ALERT),
player.getName().getString()
);
for (UUID ownerId : gps.getOwners(stack)) {
for (UUID ownerId : CollarHelper.getOwners(stack)) {
ServerPlayer owner = player
.getServer()
.getPlayerList()

View File

@@ -133,10 +133,9 @@ public class PlayerStateQuery {
BodyRegionV2.MOUTH
);
if (gag.isEmpty()) return false;
return (
gag.getItem() instanceof
com.tiedup.remake.items.base.IHasGaggingEffect
);
return com.tiedup.remake.v2.bondage.datadriven.DataDrivenBondageItem.getComponent(
gag, com.tiedup.remake.v2.bondage.component.ComponentType.GAGGING,
com.tiedup.remake.v2.bondage.component.GaggingComponent.class) != null;
}
/**
@@ -150,10 +149,9 @@ public class PlayerStateQuery {
BodyRegionV2.EYES
);
if (blindfold.isEmpty()) return false;
return (
blindfold.getItem() instanceof
com.tiedup.remake.items.base.IHasBlindingEffect
);
return com.tiedup.remake.v2.bondage.datadriven.DataDrivenBondageItem.getComponent(
blindfold, com.tiedup.remake.v2.bondage.component.ComponentType.BLINDING,
com.tiedup.remake.v2.bondage.component.BlindingComponent.class) != null;
}
/**

View File

@@ -199,10 +199,13 @@ public class StruggleAccessory extends StruggleState {
if (
!collar.isEmpty() &&
collar.getItem() instanceof
com.tiedup.remake.items.ItemShockCollar shockCollar
com.tiedup.remake.v2.bondage.CollarHelper.canShock(collar)
) {
return shockCollar.notifyStruggle(player, collar);
// V2 shock collarnotify via IHasResistance
if (collar.getItem() instanceof com.tiedup.remake.items.base.IHasResistance resistance) {
resistance.notifyStruggle(player);
}
return true;
}
return true; // No collar, proceed normally
}

View File

@@ -6,7 +6,6 @@ import com.tiedup.remake.core.SystemMessageManager.MessageCategory;
import com.tiedup.remake.core.TiedUpMod;
import com.tiedup.remake.items.base.IHasResistance;
import com.tiedup.remake.items.base.ILockable;
import com.tiedup.remake.items.base.ItemBind;
import com.tiedup.remake.state.IPlayerLeashAccess;
import com.tiedup.remake.state.PlayerBindState;
import com.tiedup.remake.v2.BodyRegionV2;
@@ -155,10 +154,6 @@ public class StruggleBinds extends StruggleState {
);
if (!collar.isEmpty() && CollarHelper.canShock(collar)) {
// V1 shock collar
if (collar.getItem() instanceof com.tiedup.remake.items.ItemShockCollar shockCollar) {
return shockCollar.notifyStruggle(player, collar);
}
// V2 shock collar — notify via IHasResistance if available
if (collar.getItem() instanceof IHasResistance resistance) {
resistance.notifyStruggle(player);
@@ -339,8 +334,6 @@ public class StruggleBinds extends StruggleState {
);
if (comp != null) {
baseResistance = comp.getBaseResistance();
} else if (bindStack.getItem() instanceof ItemBind bind) {
baseResistance = SettingsAccessor.getBindResistance(bind.getItemName());
} else {
baseResistance = 100;
}

View File

@@ -4,7 +4,6 @@ import com.tiedup.remake.core.SystemMessageManager.MessageCategory;
import com.tiedup.remake.core.TiedUpMod;
import com.tiedup.remake.items.base.IHasResistance;
import com.tiedup.remake.items.base.ILockable;
import com.tiedup.remake.items.base.ItemCollar;
import com.tiedup.remake.state.PlayerBindState;
import com.tiedup.remake.v2.BodyRegionV2;
import com.tiedup.remake.v2.bondage.CollarHelper;
@@ -139,10 +138,6 @@ public class StruggleCollar extends StruggleState {
ItemStack collar = V2EquipmentHelper.getInRegion(player, BodyRegionV2.NECK);
if (!collar.isEmpty() && CollarHelper.canShock(collar)) {
// V1 shock collar
if (collar.getItem() instanceof com.tiedup.remake.items.ItemShockCollar shockCollar) {
return shockCollar.notifyStruggle(player, collar);
}
// V2 shock collar — notify via IHasResistance
if (collar.getItem() instanceof IHasResistance resistance) {
resistance.notifyStruggle(player);