Bukkit  1.4.7-R1.0
 All Classes Namespaces Files Functions Variables Enumerator Pages
SpawnEgg.java
Go to the documentation of this file.
1 package org.bukkit.material;
2 
3 import org.bukkit.Material;
4 import org.bukkit.entity.EntityType;
5 
9 public class SpawnEgg extends MaterialData {
10  public SpawnEgg() {
11  super(Material.MONSTER_EGG);
12  }
13 
14  public SpawnEgg(int type, byte data){
15  super(type, data);
16  }
17 
18  public SpawnEgg(byte data) {
19  super(Material.MONSTER_EGG, data);
20  }
21 
22  public SpawnEgg(EntityType type) {
23  this();
24  setSpawnedType(type);
25  }
26 
32  return EntityType.fromId(getData());
33  }
34 
39  public void setSpawnedType(EntityType type) {
40  setData((byte) type.getTypeId());
41  }
42 
43  @Override
44  public String toString() {
45  return "SPAWN EGG{" + getSpawnedType() + "}";
46  }
47 
48  @Override
49  public SpawnEgg clone() {
50  return (SpawnEgg) super.clone();
51  }
52 }