#915: Add support for virtual entities

By: Jishuna <joshl5324@gmail.com>
This commit is contained in:
Bukkit/Spigot
2023-11-19 19:03:25 +13:00
parent 1f322369a0
commit 90df6eb97a
9 changed files with 525 additions and 3 deletions

View File

@@ -1,8 +1,10 @@
package org.bukkit.inventory.meta;
import org.bukkit.entity.EntitySnapshot;
import org.bukkit.entity.EntityType;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Represents a spawn egg and it's spawned type.
@@ -30,6 +32,28 @@ public interface SpawnEggMeta extends ItemMeta {
@Contract("_ -> fail")
void setSpawnedType(EntityType type);
/**
* Gets the {@link EntitySnapshot} that will be spawned by this spawn egg or null if no entity
* has been set. <br>
* <p>
* All applicable data from the egg will be copied, such as custom name, health,
* and velocity. <br>
*
* @return the entity snapshot or null if no entity has been set
*/
@Nullable
EntitySnapshot getSpawnedEntity();
/**
* Sets the {@link EntitySnapshot} that will be spawned by this spawn egg. <br>
* <p>
* All applicable data from the entity will be copied, such as custom name,
* health, and velocity. <br>
*
* @param snapshot the snapshot
*/
void setSpawnedEntity(@NotNull EntitySnapshot snapshot);
@NotNull
@Override
SpawnEggMeta clone();