if (quantity > 0) {
if (quantity > 0 && isEnabled()) {
    public void set() {        int quantity = getQuantity();        ambient[0] = 0;        ambient[1] = 0;        ambient[2] = 0;        ambient[3] = 1;        color[0] = 0;        color[1] = 0;        color[2] = 0;        color[3] = 1;        if(twoSidedOn) {            GL11.glLightModeli(GL11.GL_LIGHT_MODEL_TWO_SIDE, GL11.GL_TRUE);        }        if (quantity > 0) {            GL11.glEnable(GL11.GL_LIGHTING);            for (int i = 0; i < quantity; i++) {                Light light = get(i);                if (light.isEnabled()) {                    int index = GL11.GL_LIGHT0 + i;                    GL11.glEnable(index);                    color[0] = light.getAmbient().r;                    color[1] = light.getAmbient().g;                    color[2] = light.getAmbient().b;                    buffer.clear();                    buffer.put(color);                    buffer.flip();                    GL11.glLightfv(index, GL11.GL_AMBIENT, buffer);                    color[0] = light.getDiffuse().r;                    color[1] = light.getDiffuse().g;                    color[2] = light.getDiffuse().b;                    buffer.clear();                    buffer.put(color);                    buffer.flip();                    GL11.glLightfv(index, GL11.GL_DIFFUSE, buffer);                    color[0] = light.getSpecular().r;                    color[1] = light.getSpecular().g;                    color[2] = light.getSpecular().b;                    buffer.clear();                    buffer.put(color);                    buffer.flip();                    GL11.glLightfv(index, GL11.GL_SPECULAR, buffer);                    if (light.isAttenuate()) {                        GL11.glLightf(                            index,                            GL11.GL_CONSTANT_ATTENUATION,                            light.getConstant());                        GL11.glLightf(                            index,                            GL11.GL_LINEAR_ATTENUATION,                            light.getLinear());                        GL11.glLightf(                            index,                            GL11.GL_QUADRATIC_ATTENUATION,                            light.getQuadratic());                    } else {                        GL11.glLightf(index, GL11.GL_CONSTANT_ATTENUATION, 1.0f);                        GL11.glLightf(index, GL11.GL_LINEAR_ATTENUATION, 0.0f);                        GL11.glLightf(index, GL11.GL_QUADRATIC_ATTENUATION, 0.0f);                    }                    if (light.getType() == Light.LT_AMBIENT) {                        ambient[0] += light.getAmbient().r;                        ambient[1] += light.getAmbient().g;                        ambient[2] += light.getAmbient().b;                    }                    switch (light.getType()) {                        case Light.LT_DIRECTIONAL :                            {                                DirectionalLight pkDL =                                    (DirectionalLight) light;                                posParam[0] = -pkDL.getDirection().x;                                posParam[1] = -pkDL.getDirection().y;                                posParam[2] = -pkDL.getDirection().z;                                posParam[3] = 0.0f;                                buffer.clear();                                buffer.put(posParam);                                buffer.flip();                                GL11.glLightfv(index, GL11.GL_POSITION, buffer);                                break;                            }                        case Light.LT_POINT :                        case Light.LT_SPOT :                            {                                PointLight pkPL = (PointLight) light;                                posParam[0] = pkPL.getLocation().x;                                posParam[1] = pkPL.getLocation().y;                                posParam[2] = pkPL.getLocation().z;                                posParam[3] = 1.0f;                                buffer.clear();                                buffer.put(posParam);                                buffer.flip();                                GL11.glLightfv(index, GL11.GL_POSITION, buffer);                                break;                            }                    }                    if (light.getType() == Light.LT_SPOT) {                        SpotLight spot = (SpotLight) light;                        GL11.glLightf(                            index,                            GL11.GL_SPOT_CUTOFF,                            180.0f * spot.getAngle() / (float) Math.PI);                        buffer.clear();                        spotDir[0]= spot.getDirection().x;                        spotDir[1]= spot.getDirection().y;                        spotDir[2]= spot.getDirection().z;                        buffer.put(spotDir);//                        buffer.flip();                        GL11.glLightfv(index, GL11.GL_SPOT_DIRECTION, buffer);                        GL11.glLightf(                            index,                            GL11.GL_SPOT_EXPONENT,                            spot.getExponent());                    } else {                        defaultDirection[0] = 0.0f;                        defaultDirection[1] = 0.0f;                        defaultDirection[2] = -1.0f;                        GL11.glLightf(index, GL11.GL_SPOT_CUTOFF, 180.0f);                        buffer.clear();                        buffer.put(defaultDirection);//                        buffer.flip();                        GL11.glLightfv(index, GL11.GL_SPOT_DIRECTION, buffer);                        GL11.glLightf(index, GL11.GL_SPOT_EXPONENT, 0.0f);                    }                } else {                    GL11.glDisable(GL11.GL_LIGHT0 + i);                }            }            buffer.clear();            buffer.put(ambient);            buffer.flip();            GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, buffer);            for (int i = quantity; i < MAX_LIGHTS_ALLOWED; i++)                GL11.glDisable((GL11.GL_LIGHT0 + i));        } else {            GL11.glDisable(GL11.GL_LIGHTING);        }    }