Skip to content

Commit b0b7f89

Browse files
committed
Add EntityType/Archetype retrieval for SpawnEggs
Signed-off-by: Gabriel Harris-Rouquette <gabizou@me.com>
1 parent 68f7ef5 commit b0b7f89

File tree

1 file changed

+22
-0
lines changed
  • src/main/java/org/spongepowered/api/data

1 file changed

+22
-0
lines changed

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,28 @@ public final class Keys {
751751
*/
752752
public static final Key<Value<Ticks>> END_GATEWAY_AGE = Keys.key(ResourceKey.sponge("end_gateway_age"), Ticks.class);
753753

754+
/**
755+
* The {@link EntityType entity type} of a spawn egg, which may be one of
756+
* several based on {@link ItemTypes#ZOMBIE_SPAWN_EGG}, etc. It is not
757+
* guaranteed that the type of entity is the same as the one that will be
758+
* spawned when used. It is likely unable to change the type of entity on
759+
* an {@link ItemStack}, but it is possible to change the
760+
* {@link EntityArchetype archetype} by using {@link #ENTITY_TO_SPAWN}.
761+
*
762+
* @see #ENTITY_TO_SPAWN
763+
*/
764+
@SuppressWarnings("unchecked")
765+
public static final Key<Value<? extends EntityType<?>>> ENTITY_TYPE = Keys.key(ResourceKey.sponge("entity_type"), (Class) EntityType.class);
766+
767+
/**
768+
* The {@link EntityArchetype} to spawn from any spawn egg, such as a
769+
* {@link ItemTypes#ZOMBIE_SPAWN_EGG} or {@link ItemTypes#CREEPER_SPAWN_EGG}.
770+
* <p>The {@link #ENTITY_TYPE} is not guaranteed to be the same as the
771+
* {@link EntityArchetype#type()} returned, but the spawned entity will be
772+
* based on the {@link EntityArchetype} returned here.
773+
*/
774+
public static final Key<Value<EntityArchetype>> ENTITY_TO_SPAWN = Keys.key(ResourceKey.sponge("entity_to_spawn"), EntityArchetype.class);
775+
754776
/**
755777
* The {@link EquipmentType} that the target inventory supports. This usually applies to {@link EquipmentSlot}s.
756778
* or

0 commit comments

Comments
 (0)