diff --git a/pom.xml b/pom.xml
index cd8ce53..969308a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.asintoto
Basic
- 1.2.0
+ 1.2.1
jar
Basic
diff --git a/src/main/java/com/asintoto/basic/items/ItemCreator.java b/src/main/java/com/asintoto/basic/items/ItemCreator.java
index e57ee7a..23cb190 100644
--- a/src/main/java/com/asintoto/basic/items/ItemCreator.java
+++ b/src/main/java/com/asintoto/basic/items/ItemCreator.java
@@ -4,6 +4,7 @@
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
+import org.bukkit.entity.EntityType;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemFlag;
@@ -210,4 +211,30 @@ public void give(Player p) {
public static ItemCreator of(Material m) {
return new ItemCreator(m);
}
+
+ public static ItemCreator ofEgg(EntityType type) {
+ return of(makeMonsterEgg(type));
+ }
+
+ private static Material makeMonsterEgg(EntityType type) {
+ Material created = Material.SHEEP_SPAWN_EGG;
+
+ try {
+ String name = type.toString().toUpperCase() + "_SPAWN_EGG";
+
+ if (type.name().equals("MUSHROOM_COW") || type.name().equals("MOOSHROOM"))
+ name = "MOOSHROOM_SPAWN_EGG";
+
+ created = Material.valueOf(name);
+
+ if(created == null) {
+ return Material.SHEEP_SPAWN_EGG;
+ }
+
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+
+ return created;
+ }
}