feat(D-01/E): BuiltInLockComponent for organic items (E2)
- New BuiltInLockComponent: blocksUnequip() returns true (permanent lock) - ComponentType: add BUILT_IN_LOCK enum value - 8 organic item JSONs updated (slime, vine, web, tape variants) - DataDrivenBondageItem: add hasBuiltInLock() static helper
This commit is contained in:
@@ -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),
|
GPS("gps", GpsComponent::fromJson),
|
||||||
CHOKING("choking", ChokingComponent::fromJson),
|
CHOKING("choking", ChokingComponent::fromJson),
|
||||||
ADJUSTABLE("adjustable", AdjustableComponent::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 String jsonKey;
|
||||||
private final Function<JsonObject, IItemComponent> factory;
|
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.TyingInteractionHelper;
|
||||||
import com.tiedup.remake.v2.bondage.V2BondageItems;
|
import com.tiedup.remake.v2.bondage.V2BondageItems;
|
||||||
import com.tiedup.remake.v2.bondage.capability.V2EquipmentHelper;
|
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.ComponentHolder;
|
||||||
import com.tiedup.remake.v2.bondage.component.ComponentType;
|
import com.tiedup.remake.v2.bondage.component.ComponentType;
|
||||||
import com.tiedup.remake.v2.bondage.component.IItemComponent;
|
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.
|
* Stack-aware padlock attachment check for data-driven items.
|
||||||
* Returns false for organic items (slime, vine, web, tape) that have
|
* Returns false for organic items (slime, vine, web, tape) that have
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
"components": {
|
"components": {
|
||||||
"resistance": {
|
"resistance": {
|
||||||
"id": "tape"
|
"id": "tape"
|
||||||
}
|
},
|
||||||
|
"built_in_lock": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
"components": {
|
"components": {
|
||||||
"resistance": {
|
"resistance": {
|
||||||
"id": "slime"
|
"id": "slime"
|
||||||
}
|
},
|
||||||
|
"built_in_lock": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
"gagging": {
|
"gagging": {
|
||||||
"material": "stuffed"
|
"material": "stuffed"
|
||||||
},
|
},
|
||||||
"adjustable": {}
|
"adjustable": {},
|
||||||
|
"built_in_lock": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
"gagging": {
|
"gagging": {
|
||||||
"material": "tape"
|
"material": "tape"
|
||||||
},
|
},
|
||||||
"adjustable": {}
|
"adjustable": {},
|
||||||
|
"built_in_lock": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
"gagging": {
|
"gagging": {
|
||||||
"material": "stuffed"
|
"material": "stuffed"
|
||||||
},
|
},
|
||||||
"adjustable": {}
|
"adjustable": {},
|
||||||
|
"built_in_lock": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
"components": {
|
"components": {
|
||||||
"resistance": {
|
"resistance": {
|
||||||
"id": "vine"
|
"id": "vine"
|
||||||
}
|
},
|
||||||
|
"built_in_lock": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
"components": {
|
"components": {
|
||||||
"resistance": {
|
"resistance": {
|
||||||
"id": "web"
|
"id": "web"
|
||||||
}
|
},
|
||||||
|
"built_in_lock": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
"gagging": {
|
"gagging": {
|
||||||
"material": "stuffed"
|
"material": "stuffed"
|
||||||
},
|
},
|
||||||
"adjustable": {}
|
"adjustable": {},
|
||||||
|
"built_in_lock": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
"components": {
|
"components": {
|
||||||
"resistance": {
|
"resistance": {
|
||||||
"id": "tape"
|
"id": "tape"
|
||||||
}
|
},
|
||||||
|
"built_in_lock": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
"components": {
|
"components": {
|
||||||
"resistance": {
|
"resistance": {
|
||||||
"id": "slime"
|
"id": "slime"
|
||||||
}
|
},
|
||||||
|
"built_in_lock": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
"gagging": {
|
"gagging": {
|
||||||
"material": "stuffed"
|
"material": "stuffed"
|
||||||
},
|
},
|
||||||
"adjustable": {}
|
"adjustable": {},
|
||||||
|
"built_in_lock": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
"gagging": {
|
"gagging": {
|
||||||
"material": "tape"
|
"material": "tape"
|
||||||
},
|
},
|
||||||
"adjustable": {}
|
"adjustable": {},
|
||||||
|
"built_in_lock": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
"gagging": {
|
"gagging": {
|
||||||
"material": "stuffed"
|
"material": "stuffed"
|
||||||
},
|
},
|
||||||
"adjustable": {}
|
"adjustable": {},
|
||||||
|
"built_in_lock": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
"components": {
|
"components": {
|
||||||
"resistance": {
|
"resistance": {
|
||||||
"id": "vine"
|
"id": "vine"
|
||||||
}
|
},
|
||||||
|
"built_in_lock": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
"components": {
|
"components": {
|
||||||
"resistance": {
|
"resistance": {
|
||||||
"id": "web"
|
"id": "web"
|
||||||
}
|
},
|
||||||
|
"built_in_lock": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
"gagging": {
|
"gagging": {
|
||||||
"material": "stuffed"
|
"material": "stuffed"
|
||||||
},
|
},
|
||||||
"adjustable": {}
|
"adjustable": {},
|
||||||
|
"built_in_lock": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user