use of com.microsoft.Malmo.Schemas.WoodTypes in project malmo by Microsoft.
the class MinecraftTypeHelper method attemptToGetAsVariant.
/**
* Attempt to parse string as a Variation
* @param part string token to parse
* @return the BlockVariant enum value for the requested variant, or null if it wasn't valid.
*/
public static Variation attemptToGetAsVariant(String part) {
// and have an object in the schemas that returns a list, so we can just iterate...
try {
StoneTypes var = StoneTypes.valueOf(part.toUpperCase());
if (var != null) {
Variation bv = new Variation();
bv.setValue(var.value());
return bv;
}
} catch (Exception e) {
// Does nothing.
}
try {
WoodTypes var = WoodTypes.valueOf(part.toUpperCase());
if (var != null) {
Variation bv = new Variation();
bv.setValue(var.value());
return bv;
}
} catch (Exception e) {
// Does nothing.
}
try {
FlowerTypes var = FlowerTypes.fromValue(part);
if (var != null) {
Variation bv = new Variation();
bv.setValue(var.value());
return bv;
}
} catch (Exception e) {
// Does nothing.
}
try {
EntityTypes var = EntityTypes.fromValue(part);
if (var != null) {
Variation bv = new Variation();
bv.setValue(var.value());
return bv;
}
} catch (Exception e) {
// Does nothing.
}
try {
MonsterEggTypes var = MonsterEggTypes.fromValue(part);
if (var != null) {
Variation bv = new Variation();
bv.setValue(var.value());
return bv;
}
} catch (Exception e) {
// Does nothing.
}
try {
ShapeTypes var = ShapeTypes.fromValue(part);
if (var != null) {
Variation bv = new Variation();
bv.setValue(var.value());
return bv;
}
} catch (Exception e) {
// Does nothing.
}
try {
HalfTypes var = HalfTypes.fromValue(part);
if (var != null) {
Variation bv = new Variation();
bv.setValue(var.value());
return bv;
}
} catch (Exception e) {
// Does nothing.
}
return null;
}
Aggregations