From cc2c92d5cba77c6a1f6cf75f4047fd72f1364992 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Sat, 29 Oct 2011 08:09:03 +0100 Subject: [PATCH] Added class type to CreatureType enum By: Nathan Adams --- .../java/org/bukkit/entity/CreatureType.java | 44 +++++++++++-------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/paper-api/src/main/java/org/bukkit/entity/CreatureType.java b/paper-api/src/main/java/org/bukkit/entity/CreatureType.java index 37779b9a38..9d2f568636 100644 --- a/paper-api/src/main/java/org/bukkit/entity/CreatureType.java +++ b/paper-api/src/main/java/org/bukkit/entity/CreatureType.java @@ -5,26 +5,27 @@ import java.util.HashMap; import java.util.Map; public enum CreatureType { - CHICKEN("Chicken"), - COW("Cow"), - CREEPER("Creeper"), - GHAST("Ghast"), - GIANT("Giant"), - MONSTER("Monster"), - PIG("Pig"), - PIG_ZOMBIE("PigZombie"), - SHEEP("Sheep"), - SKELETON("Skeleton"), - SLIME("Slime"), - SPIDER("Spider"), - SQUID("Squid"), - ZOMBIE("Zombie"), - WOLF("Wolf"), - CAVE_SPIDER("CaveSpider"), - ENDERMAN("Enderman"), - SILVERFISH("Silverfish"); + CHICKEN("Chicken", Chicken.class), + COW("Cow", Cow.class), + CREEPER("Creeper", Creeper.class), + GHAST("Ghast", Ghast.class), + GIANT("Giant", Giant.class), + MONSTER("Monster", Monster.class), + PIG("Pig", Pig.class), + PIG_ZOMBIE("PigZombie", PigZombie.class), + SHEEP("Sheep", Sheep.class), + SKELETON("Skeleton", Skeleton.class), + SLIME("Slime", Slime.class), + SPIDER("Spider", Spider.class), + SQUID("Squid", Squid.class), + ZOMBIE("Zombie", Zombie.class), + WOLF("Wolf", Wolf.class), + CAVE_SPIDER("CaveSpider", CaveSpider.class), + ENDERMAN("Enderman", Enderman.class), + SILVERFISH("Silverfish", Silverfish.class); private String name; + private Class clazz; private static final Map mapping = new HashMap(); @@ -34,13 +35,18 @@ public enum CreatureType { } } - private CreatureType(String name) { + private CreatureType(String name, Class clazz) { this.name = name; + this.clazz = clazz; } public String getName() { return name; } + + public Class getEntityClass() { + return clazz; + } public static CreatureType fromName(String name) { return mapping.get(name);