Geyser/connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java

33 lines
925 B
Java
Raw Normal View History

2019-08-03 03:38:09 +00:00
package org.geysermc.connector.utils;
import com.github.steveice10.mc.protocol.data.game.entity.type.MobType;
2019-08-03 06:51:05 +00:00
import com.github.steveice10.mc.protocol.data.game.entity.type.object.ObjectType;
2019-08-03 03:38:09 +00:00
import org.geysermc.connector.entity.type.EntityType;
public class EntityUtils {
public static MobType toJavaEntity(EntityType type) {
try {
return MobType.valueOf(type.name());
} catch (IllegalArgumentException ex) {
return null;
}
}
public static EntityType toBedrockEntity(MobType type) {
try {
return EntityType.valueOf(type.name());
} catch (IllegalArgumentException ex) {
return null;
}
}
2019-08-03 06:51:05 +00:00
public static EntityType toBedrockEntity(ObjectType type) {
try {
return EntityType.valueOf(type.name());
} catch (IllegalArgumentException ex) {
return null;
}
}
2019-08-03 03:38:09 +00:00
}