mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 19:49:35 +01:00
Added class type to CreatureType enum
By: Nathan Adams <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
67a69090f5
commit
cc2c92d5cb
1 changed files with 25 additions and 19 deletions
|
@ -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<? extends Entity> clazz;
|
||||
|
||||
private static final Map<String, CreatureType> mapping = new HashMap<String, CreatureType>();
|
||||
|
||||
|
@ -34,13 +35,18 @@ public enum CreatureType {
|
|||
}
|
||||
}
|
||||
|
||||
private CreatureType(String name) {
|
||||
private CreatureType(String name, Class<? extends Entity> clazz) {
|
||||
this.name = name;
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Class<? extends Entity> getEntityClass() {
|
||||
return clazz;
|
||||
}
|
||||
|
||||
public static CreatureType fromName(String name) {
|
||||
return mapping.get(name);
|
||||
|
|
Loading…
Reference in a new issue