Skip to content

Commit 656efea

Browse files
authored
Add keys related to minecraft:equippable data component (#2612)
1 parent 1f58ca7 commit 656efea

1 file changed

Lines changed: 45 additions & 1 deletion

File tree

  • src/main/java/org/spongepowered/api/data

src/main/java/org/spongepowered/api/data/Keys.java

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,11 @@ public final class Keys {
397397
*/
398398
public static final Key<Value<ParticleConfig>> AMBIENT_PARTICLE = Keys.key(ResourceKey.sponge("ambient_particle"), ParticleConfig.class);
399399

400+
/**
401+
* The set of {@link EntityType} allowed to equip an {@link ItemStack}.
402+
*/
403+
public static final Key<SetValue<EntityType<?>>> ALLOWED_ENTITIES = Keys.setKey(ResourceKey.sponge("allowed_entities"), new TypeToken<>() {});
404+
400405
/**
401406
* The ambient sound in a {@link Biome}
402407
* Readonly
@@ -648,6 +653,16 @@ public final class Keys {
648653
*/
649654
public static final Key<Value<Tag<DamageType>>> BYPASS_DAMAGE_TAG = Keys.key(ResourceKey.sponge("bypass_damage_tag"), new TypeToken<>() {});
650655

656+
/**
657+
* The {@link ResourceKey} overlay rendered when {@link ItemStack} equipped on head.
658+
*/
659+
public static final Key<Value<ResourceKey>> CAMERA_OVERLAY = Keys.key(ResourceKey.sponge("camera_overlay"), ResourceKey.class);
660+
661+
/**
662+
* Whether an equipped {@link ItemStack} can be removed using shears.
663+
*/
664+
public static final Key<Value<Boolean>> CAN_BE_SHEARED = Keys.key(ResourceKey.sponge("can_be_sheared"), Boolean.class);
665+
651666
/**
652667
* Whether an {@link ItemStack} can always be eaten.
653668
*/
@@ -960,6 +975,11 @@ public final class Keys {
960975
*/
961976
public static final Key<Value<Double>> DAMAGE_ABSORPTION = Keys.key(ResourceKey.sponge("damage_absorption"), Double.class);
962977

978+
/**
979+
* Whether an equipped {@link ItemStack} is damaged when the wearer is hurt.
980+
*/
981+
public static final Key<Value<Boolean>> DAMAGE_ON_HURT = Keys.key(ResourceKey.sponge("damage_on_hurt"), Boolean.class);
982+
963983
/**
964984
* How much damage a {@link FallingBlock} deals to {@link Living} entities
965985
* it hits per block fallen.
@@ -1128,11 +1148,20 @@ public final class Keys {
11281148
*/
11291149
public static final Key<Value<EntityArchetype>> ENTITY_TO_SPAWN = Keys.key(ResourceKey.sponge("entity_to_spawn"), EntityArchetype.class);
11301150

1151+
/**
1152+
* Whether an item is equipped when interacting with it.
1153+
*/
1154+
public static final Key<Value<Boolean>> EQUIP_ON_INTERACT = Keys.key(ResourceKey.sponge("equip_on_interact"), Boolean.class);
1155+
1156+
/**
1157+
* The {@link SoundType} played when equipping an item.
1158+
*/
1159+
public static final Key<Value<SoundType>> EQUIP_SOUND = Keys.key(ResourceKey.sponge("equip_sound"), SoundType.class);
1160+
11311161
/**
11321162
* The {@link EquipmentType} that the target inventory supports. This usually applies to {@link EquipmentSlot}s.
11331163
* or
11341164
* The {@link EquipmentType} of an {@link ItemStack}
1135-
* Readonly
11361165
*/
11371166
public static final Key<Value<EquipmentType>> EQUIPMENT_TYPE = Keys.key(ResourceKey.sponge("equipment_type"), EquipmentType.class);
11381167

@@ -1814,6 +1843,11 @@ public final class Keys {
18141843
*/
18151844
public static final Key<Value<Boolean>> IS_DISARMED = Keys.key(ResourceKey.sponge("is_disarmed"), Boolean.class);
18161845

1846+
/**
1847+
* Whether an item can be equipped using a dispenser.
1848+
*/
1849+
public static final Key<Value<Boolean>> IS_DISPENSABLE = Keys.key(ResourceKey.sponge("is_dispensable"), Boolean.class);
1850+
18171851
/**
18181852
* Whether an entity is eating.
18191853
* e.g. {@link Panda}
@@ -2179,6 +2213,11 @@ public final class Keys {
21792213
*/
21802214
public static final Key<Value<Boolean>> IS_SURROGATE_BLOCK = Keys.key(ResourceKey.sponge("is_surrogate_block"), Boolean.class);
21812215

2216+
/**
2217+
* Whether an equipped item can be swapped by interacting with it.
2218+
*/
2219+
public static final Key<Value<Boolean>> IS_SWAPPABLE = Keys.key(ResourceKey.sponge("is_swappable"), Boolean.class);
2220+
21822221
/**
21832222
* Whether players are prevented from taking
21842223
* items from an equipment slot on an {@link ArmorStand}
@@ -3093,6 +3132,11 @@ public final class Keys {
30933132
*/
30943133
public static final Key<Value<Double>> SHADOW_STRENGTH = Keys.key(ResourceKey.sponge("shadow_strength"), Double.class);
30953134

3135+
/**
3136+
* The {@link SoundType} played when removing an equipped {@link ItemStack} using shears.
3137+
*/
3138+
public static final Key<Value<SoundType>> SHEARING_SOUND = Keys.key(ResourceKey.sponge("shearing_sound"), SoundType.class);
3139+
30963140
/**
30973141
* The sound played when blocking an attack with a shield-like {@link ItemStack}.
30983142
*/

0 commit comments

Comments
 (0)