Search in sources :

Example 1 with MCFireworkType

use of com.laytonsmith.abstraction.enums.MCFireworkType in project CommandHelper by EngineHub.

the class ObjectGenerator method fireworkEffect.

public CArray fireworkEffect(MCFireworkEffect mcfe, Target t) {
    CArray fe = CArray.GetAssociativeArray(t);
    fe.set("flicker", CBoolean.get(mcfe.hasFlicker()), t);
    fe.set("trail", CBoolean.get(mcfe.hasTrail()), t);
    MCFireworkType type = mcfe.getType();
    if (type != null) {
        fe.set("type", new CString(mcfe.getType().name(), t), t);
    } else {
        fe.set("type", CNull.NULL, t);
    }
    CArray colors = new CArray(t);
    for (MCColor c : mcfe.getColors()) {
        colors.push(ObjectGenerator.GetGenerator().color(c, t), t);
    }
    fe.set("colors", colors, t);
    CArray fadeColors = new CArray(t);
    for (MCColor c : mcfe.getFadeColors()) {
        fadeColors.push(ObjectGenerator.GetGenerator().color(c, t), t);
    }
    fe.set("fade", fadeColors, t);
    return fe;
}
Also used : MCColor(com.laytonsmith.abstraction.MCColor) CArray(com.laytonsmith.core.constructs.CArray) MCFireworkType(com.laytonsmith.abstraction.enums.MCFireworkType) CString(com.laytonsmith.core.constructs.CString)

Aggregations

MCColor (com.laytonsmith.abstraction.MCColor)1 MCFireworkType (com.laytonsmith.abstraction.enums.MCFireworkType)1 CArray (com.laytonsmith.core.constructs.CArray)1 CString (com.laytonsmith.core.constructs.CString)1