feature/d01-branch-e-resistance #10
@@ -0,0 +1,27 @@
|
||||
package com.tiedup.remake.v2.bondage.component;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Component: permanent lock for organic items (slime, vine, web, tape).
|
||||
*
|
||||
* <p>These items cannot have a padlock attached but always require struggle
|
||||
* to remove — they behave as if permanently locked.</p>
|
||||
*
|
||||
* <p>JSON config: {@code "built_in_lock": {}}</p>
|
||||
*/
|
||||
public class BuiltInLockComponent implements IItemComponent {
|
||||
|
||||
private BuiltInLockComponent() {}
|
||||
|
||||
public static IItemComponent fromJson(JsonObject config) {
|
||||
return new BuiltInLockComponent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean blocksUnequip(ItemStack stack, LivingEntity entity) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,8 @@ public enum ComponentType {
|
||||
GPS("gps", GpsComponent::fromJson),
|
||||
CHOKING("choking", ChokingComponent::fromJson),
|
||||
ADJUSTABLE("adjustable", AdjustableComponent::fromJson),
|
||||
OWNERSHIP("ownership", OwnershipComponent::fromJson);
|
||||
OWNERSHIP("ownership", OwnershipComponent::fromJson),
|
||||
BUILT_IN_LOCK("built_in_lock", BuiltInLockComponent::fromJson);
|
||||
|
||||
private final String jsonKey;
|
||||
private final Function<JsonObject, IItemComponent> factory;
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.tiedup.remake.v2.bondage.IV2BondageEquipment;
|
||||
import com.tiedup.remake.v2.bondage.TyingInteractionHelper;
|
||||
import com.tiedup.remake.v2.bondage.V2BondageItems;
|
||||
import com.tiedup.remake.v2.bondage.capability.V2EquipmentHelper;
|
||||
import com.tiedup.remake.v2.bondage.component.BuiltInLockComponent;
|
||||
import com.tiedup.remake.v2.bondage.component.ComponentHolder;
|
||||
import com.tiedup.remake.v2.bondage.component.ComponentType;
|
||||
import com.tiedup.remake.v2.bondage.component.IItemComponent;
|
||||
@@ -436,6 +437,11 @@ public class DataDrivenBondageItem extends AbstractV2BondageItem {
|
||||
);
|
||||
}
|
||||
|
||||
/** Check if the item has a built-in lock (organic items: slime, vine, web, tape). */
|
||||
public static boolean hasBuiltInLock(ItemStack stack) {
|
||||
return getComponent(stack, ComponentType.BUILT_IN_LOCK, BuiltInLockComponent.class) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stack-aware padlock attachment check for data-driven items.
|
||||
* Returns false for organic items (slime, vine, web, tape) that have
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
"components": {
|
||||
"resistance": {
|
||||
"id": "tape"
|
||||
}
|
||||
},
|
||||
"built_in_lock": {}
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@
|
||||
"components": {
|
||||
"resistance": {
|
||||
"id": "slime"
|
||||
}
|
||||
},
|
||||
"built_in_lock": {}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@
|
||||
"gagging": {
|
||||
"material": "stuffed"
|
||||
},
|
||||
"adjustable": {}
|
||||
"adjustable": {},
|
||||
"built_in_lock": {}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@
|
||||
"gagging": {
|
||||
"material": "tape"
|
||||
},
|
||||
"adjustable": {}
|
||||
"adjustable": {},
|
||||
"built_in_lock": {}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@
|
||||
"gagging": {
|
||||
"material": "stuffed"
|
||||
},
|
||||
"adjustable": {}
|
||||
"adjustable": {},
|
||||
"built_in_lock": {}
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@
|
||||
"components": {
|
||||
"resistance": {
|
||||
"id": "vine"
|
||||
}
|
||||
},
|
||||
"built_in_lock": {}
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@
|
||||
"components": {
|
||||
"resistance": {
|
||||
"id": "web"
|
||||
}
|
||||
},
|
||||
"built_in_lock": {}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@
|
||||
"gagging": {
|
||||
"material": "stuffed"
|
||||
},
|
||||
"adjustable": {}
|
||||
"adjustable": {},
|
||||
"built_in_lock": {}
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@
|
||||
"components": {
|
||||
"resistance": {
|
||||
"id": "tape"
|
||||
}
|
||||
},
|
||||
"built_in_lock": {}
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@
|
||||
"components": {
|
||||
"resistance": {
|
||||
"id": "slime"
|
||||
}
|
||||
},
|
||||
"built_in_lock": {}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@
|
||||
"gagging": {
|
||||
"material": "stuffed"
|
||||
},
|
||||
"adjustable": {}
|
||||
"adjustable": {},
|
||||
"built_in_lock": {}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@
|
||||
"gagging": {
|
||||
"material": "tape"
|
||||
},
|
||||
"adjustable": {}
|
||||
"adjustable": {},
|
||||
"built_in_lock": {}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@
|
||||
"gagging": {
|
||||
"material": "stuffed"
|
||||
},
|
||||
"adjustable": {}
|
||||
"adjustable": {},
|
||||
"built_in_lock": {}
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@
|
||||
"components": {
|
||||
"resistance": {
|
||||
"id": "vine"
|
||||
}
|
||||
},
|
||||
"built_in_lock": {}
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@
|
||||
"components": {
|
||||
"resistance": {
|
||||
"id": "web"
|
||||
}
|
||||
},
|
||||
"built_in_lock": {}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@
|
||||
"gagging": {
|
||||
"material": "stuffed"
|
||||
},
|
||||
"adjustable": {}
|
||||
"adjustable": {},
|
||||
"built_in_lock": {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user