fix(D-01): wire LockableComponent.lockResistance via getItemLockResistance() (BUG-003)

- Remove redundant blocksUnequip() from LockableComponent since
  AbstractV2BondageItem.canUnequip() already checks ILockable.isLocked()
- Add DataDrivenBondageItem.getItemLockResistance(ItemStack) that reads
  the per-item lock resistance from the LockableComponent, falling back
  to the global config value when absent
This commit is contained in:
NotEvil
2026-04-14 02:27:37 +02:00
parent bb209bcd8e
commit 456335e0dd
2 changed files with 39 additions and 13 deletions

View File

@@ -7,6 +7,7 @@ import com.tiedup.remake.v2.bondage.capability.V2EquipmentHelper;
import com.tiedup.remake.v2.bondage.component.ComponentHolder;
import com.tiedup.remake.v2.bondage.component.ComponentType;
import com.tiedup.remake.v2.bondage.component.IItemComponent;
import com.tiedup.remake.v2.bondage.component.LockableComponent;
import com.tiedup.remake.v2.bondage.component.ResistanceComponent;
import com.tiedup.remake.v2.bondage.items.AbstractV2BondageItem;
import java.util.List;
@@ -323,6 +324,30 @@ public class DataDrivenBondageItem extends AbstractV2BondageItem {
return holder.get(type, clazz);
}
/**
* Get per-item lock resistance from the LockableComponent, if present.
*
* <p>Returns the component's JSON-configured value if the stack has a
* LockableComponent, otherwise falls back to the global config value
* from {@link com.tiedup.remake.core.SettingsAccessor#getPadlockResistance}.</p>
*
* @param stack the ItemStack to inspect
* @return lock resistance value for this specific item
*/
public static int getItemLockResistance(ItemStack stack) {
LockableComponent comp = getComponent(
stack,
ComponentType.LOCKABLE,
LockableComponent.class
);
if (comp != null) {
return comp.getLockResistance();
}
return com.tiedup.remake.core.SettingsAccessor.getPadlockResistance(
null
);
}
// ===== FACTORY =====
/**