13
0
geforkt von Mirrors/Paper

SPIGOT-1592: Implement ItemMeta for Spawn Eggs

The Minecraft implementation of spawn eggs is able to construct an entity using all data that is present in the save format, however since the Bukkit API has no such way to construct an entity unattached to a world, and it appears creating such a way is a very challenging task, the decision was instead made to add this API now that 1.11 has entities which may not be represented by data values.
In the future it may be possible to implement a more expanded API cognate with this one.

By: Matthew <stteg@hotmail.com>
Dieser Commit ist enthalten in:
Bukkit/Spigot 2016-12-06 21:12:13 +11:00
Ursprung 8c5665d841
Commit ef84e6b90f
2 geänderte Dateien mit 33 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,28 @@
package org.bukkit.inventory.meta;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
/**
* Represents a {@link Material#MONSTER_EGG} and it's spawned type.
*/
public interface SpawnEggMeta extends ItemMeta {
/**
* Get the type of entity this egg will spawn.
*
* @return The entity type. May be null for implementation specific default.
*/
EntityType getSpawnedType();
/**
* Set the type of entity this egg will spawn.
*
* @param type The entity type. May be null for implementation specific
* default.
*/
void setSpawnedType(EntityType type);
@Override
SpawnEggMeta clone();
}

Datei anzeigen

@ -2,11 +2,13 @@ package org.bukkit.material;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.SpawnEggMeta;
/** /**
* Represents a spawn egg that can be used to spawn mobs * Represents a spawn egg that can be used to spawn mobs
* @deprecated use {@link SpawnEggMeta}
*/ */
@Deprecated
public class SpawnEgg extends MaterialData { public class SpawnEgg extends MaterialData {
public SpawnEgg() { public SpawnEgg() {
@ -41,7 +43,7 @@ public class SpawnEgg extends MaterialData {
* Get the type of entity this egg will spawn. * Get the type of entity this egg will spawn.
* *
* @return The entity type. * @return The entity type.
* @deprecated This is now stored in {@link ItemMeta}. See SPIGOT-1592. * @deprecated This is now stored in {@link SpawnEggMeta}.
*/ */
@Deprecated @Deprecated
public EntityType getSpawnedType() { public EntityType getSpawnedType() {
@ -52,7 +54,7 @@ public class SpawnEgg extends MaterialData {
* Set the type of entity this egg will spawn. * Set the type of entity this egg will spawn.
* *
* @param type The entity type. * @param type The entity type.
* @deprecated This is now stored in {@link ItemMeta}. See SPIGOT-1592. * @deprecated This is now stored in {@link SpawnEggMeta}.
*/ */
@Deprecated @Deprecated
public void setSpawnedType(EntityType type) { public void setSpawnedType(EntityType type) {