fix(D-01/D): blindfold ID mismatch + dispenser V2 registration (review)
KidnapperTheme: fix "mask_blindfold" → "blindfold_mask" across 8 themes. The incorrect ID produced ghost items with no definition. DispenserBehaviors: register GenericBondageDispenseBehavior.forAnyDataDriven() for the V2 DATA_DRIVEN_ITEM singleton. Dispatches by region from the stack's definition. V1 per-variant registrations were deleted but V2 replacement was missing.
This commit is contained in:
@@ -30,9 +30,7 @@ public class DispenserBehaviors {
|
||||
|
||||
registerClothesBehaviors();
|
||||
registerRopeArrowBehavior();
|
||||
|
||||
// V2 data-driven bondage items register their own dispenser behaviors
|
||||
// via DataDrivenBondageItem.registerDispenserBehaviors()
|
||||
registerBondageItemBehavior();
|
||||
|
||||
TiedUpMod.LOGGER.info(
|
||||
"[DispenserBehaviors] Dispenser behaviors registered!"
|
||||
@@ -46,6 +44,17 @@ public class DispenserBehaviors {
|
||||
);
|
||||
}
|
||||
|
||||
private static void registerBondageItemBehavior() {
|
||||
// Single registration for the V2 data-driven item singleton.
|
||||
// GenericBondageDispenseBehavior inspects the stack's definition to determine behavior.
|
||||
if (com.tiedup.remake.v2.bondage.V2BondageItems.DATA_DRIVEN_ITEM != null) {
|
||||
DispenserBlock.registerBehavior(
|
||||
com.tiedup.remake.v2.bondage.V2BondageItems.DATA_DRIVEN_ITEM.get(),
|
||||
GenericBondageDispenseBehavior.forAnyDataDriven()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerRopeArrowBehavior() {
|
||||
DispenserBlock.registerBehavior(
|
||||
ModItems.ROPE_ARROW.get(),
|
||||
|
||||
@@ -56,6 +56,32 @@ public class GenericBondageDispenseBehavior
|
||||
|
||||
// Factory Methods
|
||||
|
||||
/** Universal behavior for the V2 data-driven item singleton. Dispatches by region. */
|
||||
public static GenericBondageDispenseBehavior forAnyDataDriven() {
|
||||
return new GenericBondageDispenseBehavior(
|
||||
stack -> DataDrivenItemRegistry.get(stack) != null,
|
||||
state -> true, // let equip() handle the check
|
||||
(state, stack) -> {
|
||||
DataDrivenItemDefinition def = DataDrivenItemRegistry.get(stack);
|
||||
if (def == null) return;
|
||||
java.util.Set<BodyRegionV2> regions = def.occupiedRegions();
|
||||
if (regions.contains(BodyRegionV2.ARMS) && !state.isTiedUp()) {
|
||||
state.equip(BodyRegionV2.ARMS, stack);
|
||||
} else if (regions.contains(BodyRegionV2.MOUTH) && !state.isGagged()) {
|
||||
state.equip(BodyRegionV2.MOUTH, stack);
|
||||
} else if (regions.contains(BodyRegionV2.EYES) && !state.isBlindfolded()) {
|
||||
state.equip(BodyRegionV2.EYES, stack);
|
||||
} else if (regions.contains(BodyRegionV2.NECK) && !state.hasCollar()) {
|
||||
state.equip(BodyRegionV2.NECK, stack);
|
||||
} else if (regions.contains(BodyRegionV2.EARS) && !state.hasEarplugs()) {
|
||||
state.equip(BodyRegionV2.EARS, stack);
|
||||
} else if (regions.contains(BodyRegionV2.HANDS) && !state.hasMittens()) {
|
||||
state.equip(BodyRegionV2.HANDS, stack);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public static GenericBondageDispenseBehavior forBind() {
|
||||
return new GenericBondageDispenseBehavior(
|
||||
BindModeHelper::isBindItem,
|
||||
|
||||
Reference in New Issue
Block a user