if (quantity > 0 && isEnabled()) {
if (isEnabled()) {
	public void apply() {		int quantity = getQuantity();		color[0] = 0;		color[1] = 0;		color[2] = 0;		color[3] = 1;		if (quantity > 0 && isEnabled()) {			GL11.glEnable(GL11.GL_LIGHTING);			if (twoSidedOn) {				GL11.glLightModeli(GL11.GL_LIGHT_MODEL_TWO_SIDE, GL11.GL_TRUE);			}			for (int i = 0; i < quantity; i++) {				int index = GL11.GL_LIGHT0 + i;				Light light = get(i);				if (light.isEnabled()) {					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.glLight(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.glLight(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.glLight(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);					}					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.glLight(index, GL11.GL_POSITION, buffer);						break;					}					case Light.LT_POINT:					case Light.LT_SPOT: {						PointLight pointLight = (PointLight) light;						posParam[0] = pointLight.getLocation().x;						posParam[1] = pointLight.getLocation().y;						posParam[2] = pointLight.getLocation().z;						posParam[3] = 1.0f;						buffer.clear();						buffer.put(posParam);						buffer.flip();						GL11.glLight(index, GL11.GL_POSITION, buffer);						break;					}					}					if (light.getType() == Light.LT_SPOT) {						SpotLight spot = (SpotLight) light;						GL11.glLightf(index, GL11.GL_SPOT_CUTOFF, spot								.getAngle());						buffer.clear();						spotDir[0] = spot.getDirection().x;						spotDir[1] = spot.getDirection().y;						spotDir[2] = spot.getDirection().z;						buffer.put(spotDir);						buffer.flip();						GL11.glLight(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.glLight(index, GL11.GL_SPOT_DIRECTION, buffer);						GL11.glLightf(index, GL11.GL_SPOT_EXPONENT, 0.0f);					}				} else {					GL11.glDisable(index);				}			}			buffer.clear();			buffer.put(globalAmbient);			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);		}	}