private int compareByStates(Geometry g1, Geometry g2) {
private int compareByStates(GeomBatch g1, GeomBatch g2) {
        private int compareByStates(Geometry g1, Geometry g2) {            TextureState ts1 = (TextureState)g1.states[RenderState.RS_TEXTURE];            TextureState ts2 = (TextureState)g2.states[RenderState.RS_TEXTURE];            if (ts1 == ts2) return 0;            else if (ts1 == null && ts2 != null) return -1;            else if (ts2 == null && ts1 != null) return  1;                        for (int x = 0, nots = Math.min(ts1.getNumberOfSetTextures(), ts2.getNumberOfSetTextures()); x < nots; x++) {            	            	int tid1 = ts1.getTextureID(x);            	int tid2 = ts2.getTextureID(x);            	            	if (tid1 == tid2)            		continue;            	else if (tid1 < tid2)            		return -1;            	else            		return 1;            }            return 0;        }