Search in sources :

Example 1 with FlowerTypes

use of com.microsoft.Malmo.Schemas.FlowerTypes 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;
}
Also used : EntityTypes(com.microsoft.Malmo.Schemas.EntityTypes) ShapeTypes(com.microsoft.Malmo.Schemas.ShapeTypes) StoneTypes(com.microsoft.Malmo.Schemas.StoneTypes) WoodTypes(com.microsoft.Malmo.Schemas.WoodTypes) MonsterEggTypes(com.microsoft.Malmo.Schemas.MonsterEggTypes) Variation(com.microsoft.Malmo.Schemas.Variation) FlowerTypes(com.microsoft.Malmo.Schemas.FlowerTypes) HalfTypes(com.microsoft.Malmo.Schemas.HalfTypes)

Aggregations

EntityTypes (com.microsoft.Malmo.Schemas.EntityTypes)1 FlowerTypes (com.microsoft.Malmo.Schemas.FlowerTypes)1 HalfTypes (com.microsoft.Malmo.Schemas.HalfTypes)1 MonsterEggTypes (com.microsoft.Malmo.Schemas.MonsterEggTypes)1 ShapeTypes (com.microsoft.Malmo.Schemas.ShapeTypes)1 StoneTypes (com.microsoft.Malmo.Schemas.StoneTypes)1 Variation (com.microsoft.Malmo.Schemas.Variation)1 WoodTypes (com.microsoft.Malmo.Schemas.WoodTypes)1