Commits
md_5 authored aa1347ae6a9
1 1 | package org.bukkit.material; |
2 2 | |
3 3 | import org.bukkit.Material; |
4 4 | import org.bukkit.entity.EntityType; |
5 + | import org.bukkit.inventory.meta.ItemMeta; |
5 6 | |
6 7 | /** |
7 8 | * Represents a spawn egg that can be used to spawn mobs |
8 9 | */ |
9 10 | public class SpawnEgg extends MaterialData { |
10 11 | |
11 12 | public SpawnEgg() { |
12 13 | super(Material.MONSTER_EGG); |
13 14 | } |
14 15 | |
33 34 | |
34 35 | public SpawnEgg(EntityType type) { |
35 36 | this(); |
36 37 | setSpawnedType(type); |
37 38 | } |
38 39 | |
39 40 | /** |
40 41 | * Get the type of entity this egg will spawn. |
41 42 | * |
42 43 | * @return The entity type. |
44 + | * @deprecated This is now stored in {@link ItemMeta}. See SPIGOT-1592. |
43 45 | */ |
46 + | |
44 47 | public EntityType getSpawnedType() { |
45 48 | return EntityType.fromId(getData()); |
46 49 | } |
47 50 | |
48 51 | /** |
49 52 | * Set the type of entity this egg will spawn. |
50 53 | * |
51 54 | * @param type The entity type. |
55 + | * @deprecated This is now stored in {@link ItemMeta}. See SPIGOT-1592. |
52 56 | */ |
57 + | |
53 58 | public void setSpawnedType(EntityType type) { |
54 59 | setData((byte) type.getTypeId()); |
55 60 | } |
56 61 | |
57 62 | |
58 63 | public String toString() { |
59 64 | return "SPAWN EGG{" + getSpawnedType() + "}"; |
60 65 | } |
61 66 | |
62 67 | |