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

@@ -12,6 +12,8 @@ import org.jetbrains.annotations.Nullable;
* Helper class for selecting themed items for kidnappers.
* Handles probability-based item selection and color application.
*
* All bondage items are now created via DataDrivenBondageItem.createStack().
*
* Item selection order (most to least common):
* 1. Bind (arms) - 100% (always)
* 2. Gag - 50%
@@ -79,33 +81,10 @@ public class KidnapperItemSelector {
this.blindfold = blindfold;
}
/**
* Check if this selection has a gag.
*/
public boolean hasGag() {
return !gag.isEmpty();
}
/**
* Check if this selection has mittens.
*/
public boolean hasMittens() {
return !mittens.isEmpty();
}
/**
* Check if this selection has earplugs.
*/
public boolean hasEarplugs() {
return !earplugs.isEmpty();
}
/**
* Check if this selection has a blindfold.
*/
public boolean hasBlindfold() {
return !blindfold.isEmpty();
}
public boolean hasGag() { return !gag.isEmpty(); }
public boolean hasMittens() { return !mittens.isEmpty(); }
public boolean hasEarplugs() { return !earplugs.isEmpty(); }
public boolean hasBlindfold() { return !blindfold.isEmpty(); }
}
/**
@@ -129,16 +108,6 @@ public class KidnapperItemSelector {
return selectItems(false, true);
}
/**
* Calculate adjusted probability based on kidnapper type.
*
* @param baseProb Base probability for the item
* @param eliteBonus Bonus probability for elite kidnappers
* @param archerPenalty Penalty probability for archer kidnappers
* @param isElite Whether the kidnapper is elite
* @param isArcher Whether the kidnapper is an archer
* @return Adjusted probability
*/
private static double getAdjustedProbability(
double baseProb,
double eliteBonus,
@@ -152,9 +121,6 @@ public class KidnapperItemSelector {
return prob;
}
/**
* Internal item selection logic.
*/
private static SelectionResult selectItems(
boolean isElite,
boolean isArcher
@@ -163,132 +129,64 @@ public class KidnapperItemSelector {
KidnapperTheme theme = KidnapperTheme.getRandomWeighted();
// 2. Select color (if theme supports it)
// Filter out colors that don't have textures for this theme's bind
ItemColor color = theme.supportsColor()
? getValidColorForBind(theme.getBind())
? ItemColor.getRandomStandard()
: null;
// 3. Create bind (always)
ItemStack bind = createBind(theme.getBind(), color);
ItemStack bind = createItemById(theme.getBindId(), color);
// 4. Roll for gag (randomly selected from theme's compatible gags)
// 4. Roll for gag
ItemStack gag = ItemStack.EMPTY;
double gagProb = getAdjustedProbability(
PROB_GAG,
ELITE_GAG_BONUS,
ARCHER_GAG_PENALTY,
isElite,
isArcher
PROB_GAG, ELITE_GAG_BONUS, ARCHER_GAG_PENALTY, isElite, isArcher
);
if (RANDOM.nextDouble() < gagProb) {
gag = createGag(theme.getRandomGag(), color);
gag = createItemById(theme.getRandomGagId(), color);
}
// 5. Roll for mittens (same for all themes)
// 5. Roll for mittens
ItemStack mittens = ItemStack.EMPTY;
double mittensProb = getAdjustedProbability(
PROB_MITTENS,
ELITE_MITTENS_BONUS,
ARCHER_MITTENS_PENALTY,
isElite,
isArcher
PROB_MITTENS, ELITE_MITTENS_BONUS, ARCHER_MITTENS_PENALTY, isElite, isArcher
);
if (RANDOM.nextDouble() < mittensProb) {
mittens = createMittens();
}
// 6. Roll for earplugs (same for all themes)
// 6. Roll for earplugs
ItemStack earplugs = ItemStack.EMPTY;
double earplugsProb = getAdjustedProbability(
PROB_EARPLUGS,
ELITE_EARPLUGS_BONUS,
ARCHER_EARPLUGS_PENALTY,
isElite,
isArcher
PROB_EARPLUGS, ELITE_EARPLUGS_BONUS, ARCHER_EARPLUGS_PENALTY, isElite, isArcher
);
if (RANDOM.nextDouble() < earplugsProb) {
earplugs = createEarplugs();
}
// 7. Roll for blindfold (last, most restrictive - randomly selected)
// 7. Roll for blindfold
ItemStack blindfold = ItemStack.EMPTY;
double blindfoldProb = getAdjustedProbability(
PROB_BLINDFOLD,
ELITE_BLINDFOLD_BONUS,
ARCHER_BLINDFOLD_PENALTY,
isElite,
isArcher
PROB_BLINDFOLD, ELITE_BLINDFOLD_BONUS, ARCHER_BLINDFOLD_PENALTY, isElite, isArcher
);
if (theme.hasBlindfolds() && RANDOM.nextDouble() < blindfoldProb) {
blindfold = createBlindfold(theme.getRandomBlindfold(), color);
blindfold = createItemById(theme.getRandomBlindfoldId(), color);
}
return new SelectionResult(
theme,
color,
bind,
gag,
mittens,
earplugs,
blindfold
theme, color, bind, gag, mittens, earplugs, blindfold
);
}
// ITEM CREATION METHODS
/**
* Create a bind ItemStack with optional color.
* Create a data-driven bondage item by registry name, with optional color.
*/
public static ItemStack createBind(
BindVariant variant,
@Nullable ItemColor color
) {
public static ItemStack createItemById(String id, @Nullable ItemColor color) {
ItemStack stack = DataDrivenBondageItem.createStack(
new ResourceLocation("tiedup", variant.getRegistryName())
new ResourceLocation("tiedup", id)
);
if (color != null && variant.supportsColor()) {
applyColor(stack, color);
}
return stack;
}
/**
* Create a gag ItemStack with optional color.
* Validates that the color has a texture for this gag variant.
*/
public static ItemStack createGag(
GagVariant variant,
@Nullable ItemColor color
) {
ItemStack stack = DataDrivenBondageItem.createStack(
new ResourceLocation("tiedup", variant.getRegistryName())
);
if (
color != null &&
variant.supportsColor() &&
isColorValidForGag(color, variant)
) {
applyColor(stack, color);
}
return stack;
}
/**
* Create a blindfold ItemStack with optional color.
* Validates that the color has a texture for this blindfold variant.
*/
public static ItemStack createBlindfold(
BlindfoldVariant variant,
@Nullable ItemColor color
) {
ItemStack stack = DataDrivenBondageItem.createStack(
new ResourceLocation("tiedup", variant.getRegistryName())
);
if (
color != null &&
variant.supportsColor() &&
isColorValidForBlindfold(color, variant)
) {
if (color != null) {
applyColor(stack, color);
}
return stack;
@@ -296,7 +194,6 @@ public class KidnapperItemSelector {
/**
* Create mittens ItemStack.
* Mittens don't have color variants.
*/
public static ItemStack createMittens() {
return DataDrivenBondageItem.createStack(
@@ -306,7 +203,6 @@ public class KidnapperItemSelector {
/**
* Create earplugs ItemStack.
* Earplugs don't have color variants.
*/
public static ItemStack createEarplugs() {
return DataDrivenBondageItem.createStack(
@@ -321,7 +217,6 @@ public class KidnapperItemSelector {
/**
* Apply color NBT to an ItemStack.
* Sets both the ItemColor name and CustomModelData for model selection.
*/
public static void applyColor(ItemStack stack, ItemColor color) {
if (stack.isEmpty() || color == null) return;
@@ -351,141 +246,9 @@ public class KidnapperItemSelector {
/**
* Get the texture suffix for an item's color.
* Example: "ropes" + "_red" = "ropes_red"
* @return The color suffix (e.g., "_red"), or empty string if no color
*/
public static String getColorSuffix(ItemStack stack) {
ItemColor color = getColor(stack);
return color != null ? "_" + color.getName() : "";
}
// COLOR VALIDATION
/**
* Get a random color that has a texture for the given bind variant.
* Excludes colors that don't have textures for specific variants.
*/
public static ItemColor getValidColorForBind(BindVariant variant) {
ItemColor color;
int attempts = 0;
do {
color = ItemColor.getRandomStandard();
attempts++;
// Prevent infinite loop
if (attempts > 50) break;
} while (!isColorValidForBind(color, variant));
return color;
}
/**
* Check if a color has a texture for the given bind variant.
* Returns false for colors without textures.
*/
public static boolean isColorValidForBind(
ItemColor color,
BindVariant variant
) {
if (color == null || variant == null) return true;
// BROWN doesn't have textures for ROPES and SHIBARI
if (
color == ItemColor.BROWN &&
(variant == BindVariant.ROPES || variant == BindVariant.SHIBARI)
) {
return false;
}
// GRAY doesn't have texture for DUCT_TAPE
if (color == ItemColor.GRAY && variant == BindVariant.DUCT_TAPE) {
return false;
}
return true;
}
/**
* Check if a color has a texture for the given gag variant.
*/
public static boolean isColorValidForGag(
ItemColor color,
GagVariant variant
) {
if (color == null || variant == null) return true;
// GRAY doesn't have texture for TAPE_GAG
if (color == ItemColor.GRAY && variant == GagVariant.TAPE_GAG) {
return false;
}
// WHITE doesn't have texture for CLOTH_GAG and CLEAVE_GAG
if (
color == ItemColor.WHITE &&
(variant == GagVariant.CLOTH_GAG ||
variant == GagVariant.CLEAVE_GAG)
) {
return false;
}
// RED doesn't have texture for BALL_GAG and BALL_GAG_STRAP
if (
color == ItemColor.RED &&
(variant == GagVariant.BALL_GAG ||
variant == GagVariant.BALL_GAG_STRAP)
) {
return false;
}
return true;
}
/**
* Check if a color has a texture for the given blindfold variant.
*/
public static boolean isColorValidForBlindfold(
ItemColor color,
BlindfoldVariant variant
) {
if (color == null || variant == null) return true;
// BLACK doesn't have texture for CLASSIC or MASK blindfolds
if (
color == ItemColor.BLACK &&
(variant == BlindfoldVariant.CLASSIC ||
variant == BlindfoldVariant.MASK)
) {
return false;
}
return true;
}
/**
* Get a random color that has a texture for the given gag variant.
*/
public static ItemColor getValidColorForGag(GagVariant variant) {
ItemColor color;
int attempts = 0;
do {
color = ItemColor.getRandomStandard();
attempts++;
if (attempts > 50) break;
} while (!isColorValidForGag(color, variant));
return color;
}
/**
* Get a random color that has a texture for the given blindfold variant.
*/
public static ItemColor getValidColorForBlindfold(
BlindfoldVariant variant
) {
ItemColor color;
int attempts = 0;
do {
color = ItemColor.getRandomStandard();
attempts++;
if (attempts > 50) break;
} while (!isColorValidForBlindfold(color, variant));
return color;
}
}