mirror of
https://github.com/songoda/SongodaCore.git
synced 2024-11-29 13:36:08 +01:00
Re-implement CompatibleMaterial#getEggType
This commit is contained in:
parent
3575bd25b9
commit
d28a961216
@ -47,6 +47,26 @@ public class CompatibleMaterial {
|
|||||||
return getMaterial(type.name() + "_SPAWN_EGG");
|
return getMaterial(type.name() + "_SPAWN_EGG");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static EntityType getEntityForSpawnEgg(XMaterial material) {
|
||||||
|
if (!material.name().endsWith("_SPAWN_EGG")) {
|
||||||
|
throw new IllegalArgumentException("Material is not a spawn egg");
|
||||||
|
}
|
||||||
|
|
||||||
|
String entityName = material.name().substring(0, material.name().length() - "_SPAWN_EGG".length());
|
||||||
|
|
||||||
|
if (entityName.equals("MOOSHROOM")) {
|
||||||
|
entityName = "MUSHROOM_COW";
|
||||||
|
} else if (entityName.equals("ZOMBIE_PIGMAN")) {
|
||||||
|
entityName = "PIG_ZOMBIE";
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return EntityType.valueOf(entityName);
|
||||||
|
} catch (IllegalArgumentException ignore) {
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static @Nullable XMaterial getYieldForCrop(XMaterial material) {
|
public static @Nullable XMaterial getYieldForCrop(XMaterial material) {
|
||||||
switch (material) {
|
switch (material) {
|
||||||
case BEETROOTS:
|
case BEETROOTS:
|
||||||
|
Loading…
Reference in New Issue
Block a user