Thread: Internal Cape

Results 1 to 5 of 5
  1. #1 Internal Cape 
    Registered Member
    Join Date
    Jan 2016
    Posts
    106
    Thanks given
    16
    Thanks received
    14
    Rep Power
    69
    could someone help me to fix this infernal cape on Exotic release? i was going to rip it from a post someone made but he took download link down, Thanks in advanced

    Attached image

    i've got it too this, but i have no idea why it's making my char invisible! i know the textures are the same as Firecape, i done that on purpose7

    Attached image

    changed to infernal texture, just need help as too the fix for the invisible thing

    Code:
    package com.client;
    
    import java.io.DataInputStream;
    import java.io.FileInputStream;
    import java.util.ArrayList;
    import java.io.BufferedInputStream;
    import java.io.File;
    
    public class Model extends Animable {
    
    	public static void nullLoader() {
    		aClass21Array1661 = null;
    		aBooleanArray1663 = null;
    		aBooleanArray1664 = null;
    		anIntArray1666 = null;
    		anIntArray1667 = null;
    		anIntArray1668 = null;
    		anIntArray1669 = null;
    		anIntArray1670 = null;
    		anIntArray1671 = null;
    		anIntArrayArray1672 = null;
    		anIntArray1673 = null;
    		anIntArrayArray1674 = null;
    		anIntArray1675 = null;
    		anIntArray1676 = null;
    		anIntArray1677 = null;
    		modelIntArray1 = null;
    		modelIntArray2 = null;
    		modelIntArray3 = null;
    		modelIntArray4 = null;
    	}
    	
    	public void convertTexturesTo317(short[] textureIds, int[] texa, int[] texb, int[] texc, byte[] texture_coordinates) {
    		int set = 0;
    		int set2 = 0;
    		int max = 50;
    		if(textureIds != null) {
    			anIntArray1643 = new int[anInt1630];
    			anIntArray1644 = new int[anInt1630];
    			anIntArray1645 = new int[anInt1630];
    
    
    			for(int i = 0; i < anInt1630; i++) {
    				if(textureIds[i] == -1 && anIntArray1637[i] == 2) {
    					anIntArray1640[i] = 65535;
    					anIntArray1637[i] = 0;
    				}
    				if(textureIds[i] >= max || textureIds[i] < 0 || textureIds[i] == 39) {
    					anIntArray1637[i] = 0;
    					continue;
    				}
    				anIntArray1637[i] = 2+set2;
    				set2 += 4;
    				int a = anIntArray1631[i];
    				int b = anIntArray1632[i];
    				int c = anIntArray1633[i];
    				anIntArray1640[i] = textureIds[i];
    
    
    				int texture_type = -1;
    				if(texture_coordinates != null) {
    					texture_type = texture_coordinates[i] & 0xff;
    					if(texture_type != 0xff)
    						if(texa[texture_type] >= anIntArray1669.length || texb[texture_type] >= anIntArray1668.length
    								|| texc[texture_type] >= anIntArray1670.length)
    							texture_type = -1;
    				}
    				if(texture_type == 0xff)
    					texture_type = -1;
    
    
    				anIntArray1643[set] = texture_type == -1 ? a : texa[texture_type];
    				anIntArray1644[set] = texture_type == -1 ? b : texb[texture_type];
    				anIntArray1645[set++] = texture_type == -1 ? c : texc[texture_type];
    
    
    			}
    			anInt1642 = set;
    		}
    	}
    	
    	public void convertTexturesTo317(short[] textureIds, int[] texa, int[] texb, int[] texc, boolean osrs,
    			byte[] texture_coordinates) {
    		int set = 0;
    		int set2 = 0;
    		int max = 50;
    		if (textureIds != null) {
    			anIntArray1643 = new int[anInt1630];
    			anIntArray1644 = new int[anInt1630];
    			anIntArray1645 = new int[anInt1630];
    
    			for (int i = 0; i < anInt1630; i++) {
    				if (textureIds[i] == -1 && anIntArray1637[i] == 2) {
    					anIntArray1637[i] = 0;
    				}
    				if (textureIds[i] >= max || textureIds[i] < 0 || textureIds[i] == 39) {
    					anIntArray1637[i] = 0;
    					continue;
    				}
    				anIntArray1637[i] = 2 + set2;
    				set2 += 4;
    				int a = anIntArray1631[i];
    				int b = anIntArray1632[i];
    				int c = anIntArray1633[i];
    				anIntArray1640[i] = textureIds[i];
    
    				int texture_type = -1;
    				if (texture_coordinates != null) {
    					texture_type = texture_coordinates[i] & 0xff;
    					if (texture_type != 0xff)
    						if (texa[texture_type] >= anIntArray1669.length || texb[texture_type] >= anIntArray1668.length
    								|| texc[texture_type] >= anIntArray1670.length)
    							texture_type = -1;
    				}
    				if (texture_type == 0xff)
    					texture_type = -1;
    
    				anIntArray1643[set] = texture_type == -1 ? a : texa[texture_type];
    				anIntArray1644[set] = texture_type == -1 ? b : texb[texture_type];
    				anIntArray1645[set++] = texture_type == -1 ? c : texc[texture_type];
    
    			}
    			anInt1642 = set;
    		}
    	}
    	
    	public void method476(int i, int j) {
    		for (int k = 0; k < anInt1630; k++)
    			if (anIntArray1640[k] == i)
    				anIntArray1640[k] = j;
    
    	}
    
    	public void replaceColor(int i, int j, int tex) {
    		if (tex == -1) {
    			for (int k = 0; k < anInt1630; k++)
    				if (anIntArray1640[k] == i)
    					anIntArray1640[k] = j;
    		} else {
    			anInt1642 = anInt1630;
    			int set2 = 0;
    			if (anIntArray1637 == null)
    				anIntArray1637 = new int[anInt1630];
    			if (anIntArray1640 == null)
    				anIntArray1640 = new int[anInt1630];
    			anIntArray1643 = new int[anInt1630];
    			anIntArray1644 = new int[anInt1630];
    			anIntArray1645 = new int[anInt1630];
    			for (int i3 = 0; i3 < anInt1630; i3++) {
    				if (anIntArray1640[i3] != 0) {
    					anIntArray1640[i3] = tex;
    					anIntArray1637[i3] = 3 + set2;
    					set2 += 4;
    					anIntArray1643[i3] = anIntArray1631[i3];
    					anIntArray1644[i3] = anIntArray1632[i3];
    					anIntArray1645[i3] = anIntArray1633[i3];
    				}
    			}
    		}
    	}
    
    
    	public void read525Model(byte abyte0[], int modelID) {
    		Stream nc1 = new Stream(abyte0);
    		Stream nc2 = new Stream(abyte0);
    		Stream nc3 = new Stream(abyte0);
    		Stream nc4 = new Stream(abyte0);
    		Stream nc5 = new Stream(abyte0);
    		Stream nc6 = new Stream(abyte0);
    		Stream nc7 = new Stream(abyte0);
    		nc1.currentOffset = abyte0.length - 23;
    		int numVertices = nc1.readUnsignedWord();
    		int numTriangles = nc1.readUnsignedWord();
    		int numTexTriangles = nc1.readUnsignedByte();
    		Class21 ModelDef_1 = aClass21Array1661[modelID] = new Class21();
    		ModelDef_1.aByteArray368 = abyte0;
    		ModelDef_1.anInt369 = numVertices;
    		ModelDef_1.anInt370 = numTriangles;
    		ModelDef_1.anInt371 = numTexTriangles;
    		int l1 = nc1.readUnsignedByte();
    		boolean bool = (0x1 & l1 ^ 0xffffffff) == -2;
    		int i2 = nc1.readUnsignedByte();
    		int j2 = nc1.readUnsignedByte();
    		int k2 = nc1.readUnsignedByte();
    		int l2 = nc1.readUnsignedByte();
    		int i3 = nc1.readUnsignedByte();
    		int j3 = nc1.readUnsignedWord();
    		int k3 = nc1.readUnsignedWord();
    		int l3 = nc1.readUnsignedWord();
    		int i4 = nc1.readUnsignedWord();
    		int j4 = nc1.readUnsignedWord();
    		int k4 = 0;
    		int l4 = 0;
    		int i5 = 0;
    		byte[] x = null;
    		byte[] O = null;
    		byte[] J = null;
    		byte[] F = null;
    		byte[] cb = null;
    		byte[] gb = null;
    		byte[] lb = null;
    		int[] kb = null;
    		int[] y = null;
    		int[] N = null;
    		short[] D = null;
    		int[] triangleColours2 = new int[numTriangles];
    		if (numTexTriangles > 0) {
    			O = new byte[numTexTriangles];
    			nc1.currentOffset = 0;
    			for (int j5 = 0; j5 < numTexTriangles; j5++) {
    				byte byte0 = O[j5] = nc1.readSignedByte();
    				if (byte0 == 0) {
    					k4++;
    				}
    				if (byte0 >= 1 && byte0 <= 3) {
    					l4++;
    				}
    				if (byte0 == 2) {
    					i5++;
    				}
    			}
    		}
    		int k5 = numTexTriangles;
    		int l5 = k5;
    		k5 += numVertices;
    		int i6 = k5;
    		if (l1 == 1) {
    			k5 += numTriangles;
    		}
    		int j6 = k5;
    		k5 += numTriangles;
    		int k6 = k5;
    		if (i2 == 255) {
    			k5 += numTriangles;
    		}
    		int l6 = k5;
    		if (k2 == 1) {
    			k5 += numTriangles;
    		}
    		int i7 = k5;
    		if (i3 == 1) {
    			k5 += numVertices;
    		}
    		int j7 = k5;
    		if (j2 == 1) {
    			k5 += numTriangles;
    		}
    		int k7 = k5;
    		k5 += i4;
    		int l7 = k5;
    		if (l2 == 1) {
    			k5 += numTriangles * 2;
    		}
    		int i8 = k5;
    		k5 += j4;
    		int j8 = k5;
    		k5 += numTriangles * 2;
    		int k8 = k5;
    		k5 += j3;
    		int l8 = k5;
    		k5 += k3;
    		int i9 = k5;
    		k5 += l3;
    		int j9 = k5;
    		k5 += k4 * 6;
    		int k9 = k5;
    		k5 += l4 * 6;
    		int l9 = k5;
    		k5 += l4 * 6;
    		int i10 = k5;
    		k5 += l4;
    		int j10 = k5;
    		k5 += l4;
    		int k10 = k5;
    		k5 += l4 + i5 * 2;
    		int[] vertexX = new int[numVertices];
    		int[] vertexY = new int[numVertices];
    		int[] vertexZ = new int[numVertices];
    		int[] facePoint1 = new int[numTriangles];
    		int[] facePoint2 = new int[numTriangles];
    		int[] facePoint3 = new int[numTriangles];
    		anIntArray1655 = new int[numVertices];
    		anIntArray1637 = new int[numTriangles];
    		anIntArray1638 = new int[numTriangles];
    		anIntArray1639 = new int[numTriangles];
    		anIntArray1656 = new int[numTriangles];
    		if (i3 == 1) {
    			anIntArray1655 = new int[numVertices];
    		}
    		if (bool) {
    			anIntArray1637 = new int[numTriangles];
    		}
    		if (i2 == 255) {
    			anIntArray1638 = new int[numTriangles];
    		} else {
    		}
    		if (j2 == 1) {
    			anIntArray1639 = new int[numTriangles];
    		}
    		if (k2 == 1) {
    			anIntArray1656 = new int[numTriangles];
    		}
    		if (l2 == 1) {
    			D = new short[numTriangles];
    		}
    		if (l2 == 1 && numTexTriangles > 0) {
    			x = new byte[numTriangles];
    		}
    		triangleColours2 = new int[numTriangles];
    		int[] texTrianglesPoint1 = null;
    		int[] texTrianglesPoint2 = null;
    		int[] texTrianglesPoint3 = null;
    		if (numTexTriangles > 0) {
    			texTrianglesPoint1 = new int[numTexTriangles];
    			texTrianglesPoint2 = new int[numTexTriangles];
    			texTrianglesPoint3 = new int[numTexTriangles];
    			if (l4 > 0) {
    				kb = new int[l4];
    				N = new int[l4];
    				y = new int[l4];
    				gb = new byte[l4];
    				lb = new byte[l4];
    				F = new byte[l4];
    			}
    			if (i5 > 0) {
    				cb = new byte[i5];
    				J = new byte[i5];
    			}
    		}
    		nc1.currentOffset = l5;
    		nc2.currentOffset = k8;
    		nc3.currentOffset = l8;
    		nc4.currentOffset = i9;
    		nc5.currentOffset = i7;
    		int l10 = 0;
    		int i11 = 0;
    		int j11 = 0;
    		for (int k11 = 0; k11 < numVertices; k11++) {
    			int l11 = nc1.readUnsignedByte();
    			int j12 = 0;
    			if ((l11 & 1) != 0) {
    				j12 = nc2.method421();
    			}
    			int l12 = 0;
    			if ((l11 & 2) != 0) {
    				l12 = nc3.method421();
    			}
    			int j13 = 0;
    			if ((l11 & 4) != 0) {
    				j13 = nc4.method421();
    			}
    			vertexX[k11] = l10 + j12;
    			vertexY[k11] = i11 + l12;
    			vertexZ[k11] = j11 + j13;
    			l10 = vertexX[k11];
    			i11 = vertexY[k11];
    			j11 = vertexZ[k11];
    			if (anIntArray1655 != null) {
    				anIntArray1655[k11] = nc5.readUnsignedByte();
    			}
    		}
    		nc1.currentOffset = j8;
    		nc2.currentOffset = i6;
    		nc3.currentOffset = k6;
    		nc4.currentOffset = j7;
    		nc5.currentOffset = l6;
    		nc6.currentOffset = l7;
    		nc7.currentOffset = i8;
    		for (int i12 = 0; i12 < numTriangles; i12++) {
    			triangleColours2[i12] = nc1.readUnsignedWord();
    			if (l1 == 1) {
    				anIntArray1637[i12] = nc2.readSignedByte();
    				if (anIntArray1637[i12] == 2) {
    					triangleColours2[i12] = 65535;
    				}
    				anIntArray1637[i12] = 0;
    			}
    			if (i2 == 255) {
    				anIntArray1638[i12] = nc3.readSignedByte();
    			}
    			if (j2 == 1) {
    				anIntArray1639[i12] = nc4.readSignedByte();
    				if (anIntArray1639[i12] < 0) {
    					anIntArray1639[i12] = 256 + anIntArray1639[i12];
    				}
    			}
    			if (k2 == 1) {
    				anIntArray1656[i12] = nc5.readUnsignedByte();
    			}
    			if (l2 == 1) {
    				D[i12] = (short) (nc6.readUnsignedWord() - 1);
    			}
    			if (x != null) {
    				if (D[i12] != -1) {
    					x[i12] = (byte) (nc7.readUnsignedByte() - 1);
    				} else {
    					x[i12] = -1;
    				}
    			}
    		}
    		// /fix's triangle issue, but fucked up - no need, loading all 474-
    		// models
    		/*
    		 * try { for(int i12 = 0; i12 < numTriangles; i12++) {
    		 * triangleColours2[i12] = nc1.readUnsignedWord(); if(l1 == 1){
    		 * anIntArray1637[i12] = nc2.readSignedByte(); } if(i2 == 255){
    		 * anIntArray1638[i12] = nc3.readSignedByte(); } if(j2 == 1){
    		 * anIntArray1639[i12] = nc4.readSignedByte(); if(anIntArray1639[i12] <
    		 * 0) anIntArray1639[i12] = (256+anIntArray1639[i12]); } if(k2 == 1)
    		 * anIntArray1656[i12] = nc5.readUnsignedByte(); if(l2 == 1) D[i12] =
    		 * (short)(nc6.readUnsignedWord() - 1); if(x != null) if(D[i12] != -1)
    		 * x[i12] = (byte)(nc7.readUnsignedByte() -1); else x[i12] = -1; } }
    		 * catch (Exception ex) { }
    		 */
    		nc1.currentOffset = k7;
    		nc2.currentOffset = j6;
    		int k12 = 0;
    		int i13 = 0;
    		int k13 = 0;
    		int l13 = 0;
    		for (int i14 = 0; i14 < numTriangles; i14++) {
    			int j14 = nc2.readUnsignedByte();
    			if (j14 == 1) {
    				k12 = nc1.method421() + l13;
    				l13 = k12;
    				i13 = nc1.method421() + l13;
    				l13 = i13;
    				k13 = nc1.method421() + l13;
    				l13 = k13;
    				facePoint1[i14] = k12;
    				facePoint2[i14] = i13;
    				facePoint3[i14] = k13;
    			}
    			if (j14 == 2) {
    				i13 = k13;
    				k13 = nc1.method421() + l13;
    				l13 = k13;
    				facePoint1[i14] = k12;
    				facePoint2[i14] = i13;
    				facePoint3[i14] = k13;
    			}
    			if (j14 == 3) {
    				k12 = k13;
    				k13 = nc1.method421() + l13;
    				l13 = k13;
    				facePoint1[i14] = k12;
    				facePoint2[i14] = i13;
    				facePoint3[i14] = k13;
    			}
    			if (j14 == 4) {
    				int l14 = k12;
    				k12 = i13;
    				i13 = l14;
    				k13 = nc1.method421() + l13;
    				l13 = k13;
    				facePoint1[i14] = k12;
    				facePoint2[i14] = i13;
    				facePoint3[i14] = k13;
    			}
    		}
    		nc1.currentOffset = j9;
    		nc2.currentOffset = k9;
    		nc3.currentOffset = l9;
    		nc4.currentOffset = i10;
    		nc5.currentOffset = j10;
    		nc6.currentOffset = k10;
    		for (int k14 = 0; k14 < numTexTriangles; k14++) {
    			int i15 = O[k14] & 0xff;
    			if (i15 == 0) {
    				texTrianglesPoint1[k14] = nc1.readUnsignedWord();
    				texTrianglesPoint2[k14] = nc1.readUnsignedWord();
    				texTrianglesPoint3[k14] = nc1.readUnsignedWord();
    			}
    			if (i15 == 1) {
    				texTrianglesPoint1[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint2[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint3[k14] = nc2.readUnsignedWord();
    				kb[k14] = nc3.readUnsignedWord();
    				N[k14] = nc3.readUnsignedWord();
    				y[k14] = nc3.readUnsignedWord();
    				gb[k14] = nc4.readSignedByte();
    				lb[k14] = nc5.readSignedByte();
    				F[k14] = nc6.readSignedByte();
    			}
    			if (i15 == 2) {
    				texTrianglesPoint1[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint2[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint3[k14] = nc2.readUnsignedWord();
    				kb[k14] = nc3.readUnsignedWord();
    				N[k14] = nc3.readUnsignedWord();
    				y[k14] = nc3.readUnsignedWord();
    				gb[k14] = nc4.readSignedByte();
    				lb[k14] = nc5.readSignedByte();
    				F[k14] = nc6.readSignedByte();
    				cb[k14] = nc6.readSignedByte();
    				J[k14] = nc6.readSignedByte();
    			}
    			if (i15 == 3) {
    				texTrianglesPoint1[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint2[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint3[k14] = nc2.readUnsignedWord();
    				kb[k14] = nc3.readUnsignedWord();
    				N[k14] = nc3.readUnsignedWord();
    				y[k14] = nc3.readUnsignedWord();
    				gb[k14] = nc4.readSignedByte();
    				lb[k14] = nc5.readSignedByte();
    				F[k14] = nc6.readSignedByte();
    			}
    		}
    		if (i2 != 255) {
    			for (int i12 = 0; i12 < numTriangles; i12++) {
    				anIntArray1638[i12] = i2;
    			}
    		}
    		anIntArray1640 = triangleColours2;
    		anInt1626 = numVertices;
    		anInt1630 = numTriangles;
    		anIntArray1627 = vertexX;
    		anIntArray1628 = vertexY;
    		anIntArray1629 = vertexZ;
    		anIntArray1631 = facePoint1;
    		anIntArray1632 = facePoint2;
    		anIntArray1633 = facePoint3;
    		convertTexturesTo317(D, texTrianglesPoint1, texTrianglesPoint2, texTrianglesPoint3, false, x);
    		
    		switch (modelID) {
    		
    		case 8956:
    //		System.out.println("convertTexturesTo317(new short[] {");
    //		for (int i = 0; i < anIntArray1640.length; i++) {
    //			System.out.println(anIntArray1640[i] + ",");
    //		}
    //		System.out.println("}, null, null, null, null);");
    		
    		convertTexturesTo317(new short[] { 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
    				40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
    				40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
    				40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
    				40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
    				40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
    				40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
    				40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
    				40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
    				40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
    				40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
    				40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
    				40, 40, 40, 40, 40, 40, }, null, null, null, null);
    		break;
    		
    		case 8957:
    			
    			convertTexturesTo317(new short[] { 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    					24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    					24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    					24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    					24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    					24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    					24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    					24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    					24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    					24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    					24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    					24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    					24, 24, 24, 24, 24, 24, }, null, null, null, null);
    			break;
    		
    		case 5451:
    			convertTexturesTo317(new short[] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					24, 24, 24, 24, 24, 24, 24, -1, -1, -1, -1, 24, 24, 24, 24, 24, -1, -1, 24, 24, 24,
    					24, 24, -1, -1, 24, 24, -1, -1, -1, -1, -1, -1, -1, 24, -1, 24, 24, -1, -1, -1, -1, -1, -1,
    					-1, 24, -1, 24, 24, 24, 24, 24, 24, 24, 24, -1, -1, -1, -1, -1, -1, -1, -1, 24, 24, 24,
    					24, 24, 24, 24, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 24, 24,
    					24, 24, 24, 24, 24, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    					24, }, null, null, null, null);
    			break;
    		
    		case 8950:
    			convertTexturesTo317(new short[] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, -1, -1, 40,
    					40, -1, -1, -1, -1, -1, 40, 40, -1, -1, -1, 40, -1, 40, 40, 40, 40, 40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1,
    					40, 40, 40, 40, 40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, 40, 40, 40, 40, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, 40, -1, -1, 40, 40, 40, 40, 40, -1, -1, 40, 40, 40, 40, 40, 40, -1,
    					40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -1, -1, -1, 40, 40, 40, 40, 40, 40, -1, -1, 40, 40, 40, 40, 40,
    					-1, -1, 40, 40, -1, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
    					40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, }, null, null, null, null);
    			break;
    			
    		case 8951:
    			convertTexturesTo317(new short[] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 24, 24, 24, -1, -1, 24,
    					24, -1, -1, -1, -1, -1, 24, 24, -1, -1, -1, 24, -1, 24, 24, 24, 24, 24, 24, 24, 24, -1, -1, -1, -1, -1, -1, -1, -1,
    					24, 24, 24, 24, 24, 24, 24, 24, -1, -1, -1, -1, -1, -1, -1, -1, 24, 24, 24, 24, 24, 24, 24, 24, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, 24, 24, 24, 24, 24, -1, -1, 24, 24, 24, 24, 24, -1, -1, 24, 24, 24, 24, 24, 24, -1,
    					24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -1, -1, -1, 24, 24, 24, 24, 24, 24, -1, -1, 24, 24, 24, 24, 24,
    					-1, -1, 24, 24, -1, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    					24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, }, null, null, null, null);
    			break;
    			
    		case 28512:
    			convertTexturesTo317(new short[] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40,
    					40, 40, -1, -1, -1, 40, 40, 40, 40, 40, -1, -1, -1, -1, -1, -1, 40, 40,
    					40, 40, -1, -1, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, -1,
    					-1, 40, 40, 40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, -1,
    					-1, -1, -1, 40, 40, 40, 40, 40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1,
    					40, 40, 40, 40, -1, -1, -1, -1, 40, -1, -1, 40, 40, -1, -1, -1, -1, -1, 40,
    					40, 40, -1, -1, -1, -1, -1, -1, -1, 40, 40, -1, -1, -1, -1, -1, -1, -1, 40, 40,
    					40, 40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, -1, -1, 40,
    					40, -1, -1, -1, 40, 40, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, 40, 40,
    					40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, 40, 40, -1, -1, -1, -1, -1, 40, 40, 40, 40, -1, -1, 40, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, 40, -1, 40, 40, 40, 40,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, -1, -1, 40, -1, -1, -1, -1,
    					-1, 40, 40, 40, -1, -1, -1, 40, 40, -1, -1, 40, 40, 40, 40, 40, 40,
    					-1, -1, -1, 40, 40, -1, -1, -1, 40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, 40, 40, -1,
    					-1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, }, null, null, null, null);
    		break;
    		
    		case 28300:
    //			System.out.println("convertTexturesTo317(new short[] {");
    //			for (int i = 0; i < anIntArray1640.length; i++) {
    //				System.out.println(anIntArray1640[i] + ",");
    //			}
    //			System.out.println("}, null, null, null, null);");
    			convertTexturesTo317(new short[] { -1, -1, -1, -1, -1, -1, 40, 40, -1, -1, -1, -1, 40, 40, 40, -1, -1, 40,
    					-1, -1, -1, -1, -1, 40, 40, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, 40, 40, 40, 40, -1, 40, 40, 40,
    					40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
    					40, 40, 40, 40, 40, -1, -1, -1, -1, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -1, -1, -1, 40, 40,
    					40, 40, 40, 40, 40, -1, -1, -1, -1, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -1, -1, -1, 40,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, -1, -1, -1,
    					-1, 40, 40, 40, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, 40, 40, 40,
    					40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40,
    					40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, -1, 40, 40, 40, 40, 40, 40, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, -1, 40, 40, 40, 40, 40,
    					40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
    					40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
    					40, 40, 40, -1, -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, 40, 40, 40, -1, -1, -1, -1, 40, 40, 40, 40, -1, -1, -1, -1, -1, -1, 40, 40, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40,
    					40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, 40, 40, 40, 40, 40, 40, 40, 40, 40, 58, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
    					40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
    					40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
    					40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
    					40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, 40, 40, 40, 40, 40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40,
    					40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
    					40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
    					40, 40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, 58, 40, 40, 40, -1, -1, -1,
    					-1 }, null, null, null, null);
    		break;
    		
    		case 28301:
    			convertTexturesTo317(new short[] { -1, -1, -1, -1, -1, -1, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, 40, 40, 40, 40, 40, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, 40, 40, 40, -1, -1,
    					-1, 40, 40, -1, -1, -1, -1, -1, 40, 40, 40, 40, 40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, 40, 40,
    					40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, 40, 40, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40,
    					40, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, -1, -1, -1, 40, -1, -1, 40, 40, -1, -1, -1, -1, 40, 40,
    					-1, -1, -1, -1, -1, -1, -1, 40, 40, -1, 40, 40, -1, -1, 40, 40, 40, 40, 40, 40, 40, 40, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1,
    					40, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, 40, 40, 40, 40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, null, null, null, null);
    		break;
    		
    		case 28302:
    			convertTexturesTo317(new short[] { -1, -1, 40, 40, 40, 40, -1, -1, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40,
    					40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, -1, -1, -1, -1, -1,
    					-1, 40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, -1, -1, -1, 40, 40, -1, 40,
    					40, -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, -1, -1, -1, -1, -1, -1, 40, -1, -1,
    					-1, -1, -1, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, -1, -1, -1, 40, 40, 40,
    					40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, 40, 40, 40, 40,
    					-1, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, 40, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, -1, -1, -1, -1, -1, 40, 40, -1,
    					-1, -1, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, -1, 40, 40, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, 40, 40, -1, -1, -1, -1, -1, -1, 40, 40, -1, -1, 40, 40, 40, 40, 40, 40, 40, 40, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 40, 40, -1, -1, -1, -1, 40, 40,
    					-1, -1, -1, -1, -1, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -1, -1, -1, 40, 40, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    					-1 }, null, null, null, null);
    			break;
    		}
    	}
    
    	public static final byte[] read(String location) {
    		try {
    			File read = new File(location);
    			int size = (int) read.length();
    			byte data[] = new byte[size];
    			DataInputStream input = new DataInputStream(new BufferedInputStream(new FileInputStream(location)));
    			input.readFully(data, 0, size);
    			input.close();
    			return data;
    		} catch (Exception exception) {
    		}
    		return null;
    	}
    
    	public Model(int model) {
    		if (model == 0) {
    			return;
    		}
    		byte[] data = aClass21Array1661[model].aByteArray368;
    		//data = read(signlink.findcachedir() + "/Raw/" + model + ".dat");
    		if (data[data.length - 1] == -1 && data[data.length - 2] == -1) {
    			read622Model(data, model);
    		} else {
    			readOldModel(model);
    		}
    		if (newmodel[model]) {
    			scale2(4);// 2 is too big -- 3 is almost right
    			if (anIntArray1638 != null) {
    				for (int j = 0; j < anIntArray1638.length; j++) {
    					anIntArray1638[j] = 10;
    				}
    			}
    		}
    	}
    
    	public void scale2(int i) {
    		for (int i1 = 0; i1 < anInt1626; i1++) {
    			anIntArray1627[i1] = anIntArray1627[i1] / i;
    			anIntArray1628[i1] = anIntArray1628[i1] / i;
    			anIntArray1629[i1] = anIntArray1629[i1] / i;
    		}
    	}
    
    	public void read622Model(byte abyte0[], int modelID) {
    		Stream nc1 = new Stream(abyte0);
    		Stream nc2 = new Stream(abyte0);
    		Stream nc3 = new Stream(abyte0);
    		Stream nc4 = new Stream(abyte0);
    		Stream nc5 = new Stream(abyte0);
    		Stream nc6 = new Stream(abyte0);
    		Stream nc7 = new Stream(abyte0);
    		nc1.currentOffset = abyte0.length - 23;
    		int numVertices = nc1.readUnsignedWord();
    		int numTriangles = nc1.readUnsignedWord();
    		int numTexTriangles = nc1.readUnsignedByte();
    		Class21 ModelDef_1 = aClass21Array1661[modelID] = new Class21();
    		ModelDef_1.aByteArray368 = abyte0;
    		ModelDef_1.anInt369 = numVertices;
    		ModelDef_1.anInt370 = numTriangles;
    		ModelDef_1.anInt371 = numTexTriangles;
    		int l1 = nc1.readUnsignedByte();
    		boolean bool = (0x1 & l1 ^ 0xffffffff) == -2;
    		boolean bool_26_ = (0x8 & l1) == 8;
    		if (!bool_26_) {
    			read525Model(abyte0, modelID);
    			return;
    		}
    		int newformat = 0;
    		if (bool_26_) {
    			nc1.currentOffset -= 7;
    			newformat = nc1.readUnsignedByte();
    			nc1.currentOffset += 6;
    		}
    		if (newformat == 15) {
    			newmodel[modelID] = true;
    		}
    		int i2 = nc1.readUnsignedByte();
    		int j2 = nc1.readUnsignedByte();
    		int k2 = nc1.readUnsignedByte();
    		int l2 = nc1.readUnsignedByte();
    		int i3 = nc1.readUnsignedByte();
    		int j3 = nc1.readUnsignedWord();
    		int k3 = nc1.readUnsignedWord();
    		int l3 = nc1.readUnsignedWord();
    		int i4 = nc1.readUnsignedWord();
    		int j4 = nc1.readUnsignedWord();
    		int k4 = 0;
    		int l4 = 0;
    		int i5 = 0;
    		byte[] x = null;
    		byte[] O = null;
    		byte[] J = null;
    		byte[] F = null;
    		byte[] cb = null;
    		byte[] gb = null;
    		byte[] lb = null;
    		int[] kb = null;
    		int[] y = null;
    		int[] N = null;
    		short[] D = null;
    		int[] triangleColours2 = new int[numTriangles];
    		if (numTexTriangles > 0) {
    			O = new byte[numTexTriangles];
    			nc1.currentOffset = 0;
    			for (int j5 = 0; j5 < numTexTriangles; j5++) {
    				byte byte0 = O[j5] = nc1.readSignedByte();
    				if (byte0 == 0) {
    					k4++;
    				}
    				if (byte0 >= 1 && byte0 <= 3) {
    					l4++;
    				}
    				if (byte0 == 2) {
    					i5++;
    				}
    			}
    		}
    		int k5 = numTexTriangles;
    		int l5 = k5;
    		k5 += numVertices;
    		int i6 = k5;
    		if (bool) {
    			k5 += numTriangles;
    		}
    		if (l1 == 1) {
    			k5 += numTriangles;
    		}
    		int j6 = k5;
    		k5 += numTriangles;
    		int k6 = k5;
    		if (i2 == 255) {
    			k5 += numTriangles;
    		}
    		int l6 = k5;
    		if (k2 == 1) {
    			k5 += numTriangles;
    		}
    		int i7 = k5;
    		if (i3 == 1) {
    			k5 += numVertices;
    		}
    		int j7 = k5;
    		if (j2 == 1) {
    			k5 += numTriangles;
    		}
    		int k7 = k5;
    		k5 += i4;
    		int l7 = k5;
    		if (l2 == 1) {
    			k5 += numTriangles * 2;
    		}
    		int i8 = k5;
    		k5 += j4;
    		int j8 = k5;
    		k5 += numTriangles * 2;
    		int k8 = k5;
    		k5 += j3;
    		int l8 = k5;
    		k5 += k3;
    		int i9 = k5;
    		k5 += l3;
    		int j9 = k5;
    		k5 += k4 * 6;
    		int k9 = k5;
    		k5 += l4 * 6;
    		int i_59_ = 6;
    		if (newformat != 14) {
    			if (newformat >= 15) {
    				i_59_ = 9;
    			}
    		} else {
    			i_59_ = 7;
    		}
    		int l9 = k5;
    		k5 += i_59_ * l4;
    		int i10 = k5;
    		k5 += l4;
    		int j10 = k5;
    		k5 += l4;
    		int k10 = k5;
    		k5 += l4 + i5 * 2;
    		int[] vertexX = new int[numVertices];
    		int[] vertexY = new int[numVertices];
    		int[] vertexZ = new int[numVertices];
    		int[] facePoint1 = new int[numTriangles];
    		int[] facePoint2 = new int[numTriangles];
    		int[] facePoint3 = new int[numTriangles];
    		anIntArray1655 = new int[numVertices];
    		anIntArray1637 = new int[numTriangles];
    		anIntArray1638 = new int[numTriangles];
    		anIntArray1639 = new int[numTriangles];
    		anIntArray1656 = new int[numTriangles];
    		if (i3 == 1) {
    			anIntArray1655 = new int[numVertices];
    		}
    		if (bool) {
    			anIntArray1637 = new int[numTriangles];
    		}
    		if (i2 == 255) {
    			anIntArray1638 = new int[numTriangles];
    		} else {
    		}
    		if (j2 == 1) {
    			anIntArray1639 = new int[numTriangles];
    		}
    		if (k2 == 1) {
    			anIntArray1656 = new int[numTriangles];
    		}
    		if (l2 == 1) {
    			D = new short[numTriangles];
    		}
    		if (l2 == 1 && numTexTriangles > 0) {
    			x = new byte[numTriangles];
    		}
    		triangleColours2 = new int[numTriangles];
    		int[] texTrianglesPoint1 = null;
    		int[] texTrianglesPoint2 = null;
    		int[] texTrianglesPoint3 = null;
    		if (numTexTriangles > 0) {
    			texTrianglesPoint1 = new int[numTexTriangles];
    			texTrianglesPoint2 = new int[numTexTriangles];
    			texTrianglesPoint3 = new int[numTexTriangles];
    			if (l4 > 0) {
    				kb = new int[l4];
    				N = new int[l4];
    				y = new int[l4];
    				gb = new byte[l4];
    				lb = new byte[l4];
    				F = new byte[l4];
    			}
    			if (i5 > 0) {
    				cb = new byte[i5];
    				J = new byte[i5];
    			}
    		}
    		nc1.currentOffset = l5;
    		nc2.currentOffset = k8;
    		nc3.currentOffset = l8;
    		nc4.currentOffset = i9;
    		nc5.currentOffset = i7;
    		int l10 = 0;
    		int i11 = 0;
    		int j11 = 0;
    		for (int k11 = 0; k11 < numVertices; k11++) {
    			int l11 = nc1.readUnsignedByte();
    			int j12 = 0;
    			if ((l11 & 1) != 0) {
    				j12 = nc2.method421();
    			}
    			int l12 = 0;
    			if ((l11 & 2) != 0) {
    				l12 = nc3.method421();
    			}
    			int j13 = 0;
    			if ((l11 & 4) != 0) {
    				j13 = nc4.method421();
    			}
    			vertexX[k11] = l10 + j12;
    			vertexY[k11] = i11 + l12;
    			vertexZ[k11] = j11 + j13;
    			l10 = vertexX[k11];
    			i11 = vertexY[k11];
    			j11 = vertexZ[k11];
    			if (anIntArray1655 != null) {
    				anIntArray1655[k11] = nc5.readUnsignedByte();
    			}
    		}
    		nc1.currentOffset = j8;
    		nc2.currentOffset = i6;
    		nc3.currentOffset = k6;
    		nc4.currentOffset = j7;
    		nc5.currentOffset = l6;
    		nc6.currentOffset = l7;
    		nc7.currentOffset = i8;
    		for (int i12 = 0; i12 < numTriangles; i12++) {
    			triangleColours2[i12] = nc1.readUnsignedWord();
    			if (l1 == 1) {
    				anIntArray1637[i12] = nc2.readSignedByte();
    				if (anIntArray1637[i12] == 2) {
    					triangleColours2[i12] = 65535;
    				}
    				anIntArray1637[i12] = 0;
    			}
    			if (i2 == 255) {
    				anIntArray1638[i12] = nc3.readSignedByte();
    			}
    			if (j2 == 1) {
    				anIntArray1639[i12] = nc4.readSignedByte();
    				if (anIntArray1639[i12] < 0) {
    					anIntArray1639[i12] = 256 + anIntArray1639[i12];
    				}
    			}
    			if (k2 == 1) {
    				anIntArray1656[i12] = nc5.readUnsignedByte();
    			}
    			if (l2 == 1) {
    				D[i12] = (short) (nc6.readUnsignedWord() - 1);
    			}
    			if (x != null) {
    				if (D[i12] != -1) {
    					x[i12] = (byte) (nc7.readUnsignedByte() - 1);
    				} else {
    					x[i12] = -1;
    				}
    			}
    		}
    		nc1.currentOffset = k7;
    		nc2.currentOffset = j6;
    		int k12 = 0;
    		int i13 = 0;
    		int k13 = 0;
    		int l13 = 0;
    		for (int i14 = 0; i14 < numTriangles; i14++) {
    			int j14 = nc2.readUnsignedByte();
    			if (j14 == 1) {
    				k12 = nc1.method421() + l13;
    				l13 = k12;
    				i13 = nc1.method421() + l13;
    				l13 = i13;
    				k13 = nc1.method421() + l13;
    				l13 = k13;
    				facePoint1[i14] = k12;
    				facePoint2[i14] = i13;
    				facePoint3[i14] = k13;
    			}
    			if (j14 == 2) {
    				i13 = k13;
    				k13 = nc1.method421() + l13;
    				l13 = k13;
    				facePoint1[i14] = k12;
    				facePoint2[i14] = i13;
    				facePoint3[i14] = k13;
    			}
    			if (j14 == 3) {
    				k12 = k13;
    				k13 = nc1.method421() + l13;
    				l13 = k13;
    				facePoint1[i14] = k12;
    				facePoint2[i14] = i13;
    				facePoint3[i14] = k13;
    			}
    			if (j14 == 4) {
    				int l14 = k12;
    				k12 = i13;
    				i13 = l14;
    				k13 = nc1.method421() + l13;
    				l13 = k13;
    				facePoint1[i14] = k12;
    				facePoint2[i14] = i13;
    				facePoint3[i14] = k13;
    			}
    		}
    		nc1.currentOffset = j9;
    		nc2.currentOffset = k9;
    		nc3.currentOffset = l9;
    		nc4.currentOffset = i10;
    		nc5.currentOffset = j10;
    		nc6.currentOffset = k10;
    		for (int k14 = 0; k14 < numTexTriangles; k14++) {
    			int i15 = O[k14] & 0xff;
    			if (i15 == 0) {
    				texTrianglesPoint1[k14] = nc1.readUnsignedWord();
    				texTrianglesPoint2[k14] = nc1.readUnsignedWord();
    				texTrianglesPoint3[k14] = nc1.readUnsignedWord();
    			}
    			if (i15 == 1) {
    				texTrianglesPoint1[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint2[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint3[k14] = nc2.readUnsignedWord();
    				if (newformat < 15) {
    					kb[k14] = nc3.readUnsignedWord();
    					if (newformat >= 14) {
    						N[k14] = nc3.v(-1);
    					} else {
    						N[k14] = nc3.readUnsignedWord();
    					}
    					y[k14] = nc3.readUnsignedWord();
    				} else {
    					kb[k14] = nc3.v(-1);
    					N[k14] = nc3.v(-1);
    					y[k14] = nc3.v(-1);
    				}
    				gb[k14] = nc4.readSignedByte();
    				lb[k14] = nc5.readSignedByte();
    				F[k14] = nc6.readSignedByte();
    			}
    			if (i15 == 2) {
    				texTrianglesPoint1[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint2[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint3[k14] = nc2.readUnsignedWord();
    				if (newformat >= 15) {
    					kb[k14] = nc3.v(-1);
    					N[k14] = nc3.v(-1);
    					y[k14] = nc3.v(-1);
    				} else {
    					kb[k14] = nc3.readUnsignedWord();
    					if (newformat < 14) {
    						N[k14] = nc3.readUnsignedWord();
    					} else {
    						N[k14] = nc3.v(-1);
    					}
    					y[k14] = nc3.readUnsignedWord();
    				}
    				gb[k14] = nc4.readSignedByte();
    				lb[k14] = nc5.readSignedByte();
    				F[k14] = nc6.readSignedByte();
    				cb[k14] = nc6.readSignedByte();
    				J[k14] = nc6.readSignedByte();
    			}
    			if (i15 == 3) {
    				texTrianglesPoint1[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint2[k14] = nc2.readUnsignedWord();
    				texTrianglesPoint3[k14] = nc2.readUnsignedWord();
    				if (newformat < 15) {
    					kb[k14] = nc3.readUnsignedWord();
    					if (newformat < 14) {
    						N[k14] = nc3.readUnsignedWord();
    					} else {
    						N[k14] = nc3.v(-1);
    					}
    					y[k14] = nc3.readUnsignedWord();
    				} else {
    					kb[k14] = nc3.v(-1);
    					N[k14] = nc3.v(-1);
    					y[k14] = nc3.v(-1);
    				}
    				gb[k14] = nc4.readSignedByte();
    				lb[k14] = nc5.readSignedByte();
    				F[k14] = nc6.readSignedByte();
    			}
    		}
    		if (i2 != 255) {
    			for (int i12 = 0; i12 < numTriangles; i12++) {
    				anIntArray1638[i12] = i2;
    			}
    		}
    		anIntArray1640 = triangleColours2;
    		anInt1626 = numVertices;
    		anInt1630 = numTriangles;
    		anIntArray1627 = vertexX;
    		anIntArray1628 = vertexY;
    		anIntArray1629 = vertexZ;
    		anIntArray1631 = facePoint1;
    		anIntArray1632 = facePoint2;
    		anIntArray1633 = facePoint3;
    		convertTexturesTo317(D, texTrianglesPoint1, texTrianglesPoint2, texTrianglesPoint3, false, x);
    	}
    
    	/*private void readOldModel(int i) {
    		int j = -870;
    		aBoolean1618 = true;
    		aBoolean1659 = false;
    		anInt1620++;
    		Class21 class21 = aClass21Array1661[i];
    		anInt1626 = class21.anInt369;
    		anInt1630 = class21.anInt370;
    		anInt1642 = class21.anInt371;
    		anIntArray1627 = new int[anInt1626];
    		anIntArray1628 = new int[anInt1626];
    		anIntArray1629 = new int[anInt1626];
    		anIntArray1631 = new int[anInt1630];
    		anIntArray1632 = new int[anInt1630];
    		while (j >= 0) {
    			aBoolean1618 = !aBoolean1618;
    		}
    		anIntArray1633 = new int[anInt1630];
    		anIntArray1643 = new int[anInt1642];
    		anIntArray1644 = new int[anInt1642];
    		anIntArray1645 = new int[anInt1642];
    		if (class21.anInt376 >= 0) {
    			anIntArray1655 = new int[anInt1626];
    		}
    		if (class21.anInt380 >= 0) {
    			anIntArray1637 = new int[anInt1630];
    		}
    		if (class21.anInt381 >= 0) {
    			anIntArray1638 = new int[anInt1630];
    		} else {
    			anInt1641 = -class21.anInt381 - 1;
    		}
    		if (class21.anInt382 >= 0) {
    			anIntArray1639 = new int[anInt1630];
    		}
    		if (class21.anInt383 >= 0) {
    			anIntArray1656 = new int[anInt1630];
    		}
    		anIntArray1640 = new int[anInt1630];
    		Stream stream = new Stream(class21.aByteArray368);
    		stream.currentOffset = class21.anInt372;
    		Stream stream_1 = new Stream(class21.aByteArray368);
    		stream_1.currentOffset = class21.anInt373;
    		Stream stream_2 = new Stream(class21.aByteArray368);
    		stream_2.currentOffset = class21.anInt374;
    		Stream stream_3 = new Stream(class21.aByteArray368);
    		stream_3.currentOffset = class21.anInt375;
    		Stream stream_4 = new Stream(class21.aByteArray368);
    		stream_4.currentOffset = class21.anInt376;
    		int k = 0;
    		int l = 0;
    		int i1 = 0;
    		for (int j1 = 0; j1 < anInt1626; j1++) {
    			int k1 = stream.readUnsignedByte();
    			int i2 = 0;
    			if ((k1 & 1) != 0) {
    				i2 = stream_1.method421();
    			}
    			int k2 = 0;
    			if ((k1 & 2) != 0) {
    				k2 = stream_2.method421();
    			}
    			int i3 = 0;
    			if ((k1 & 4) != 0) {
    				i3 = stream_3.method421();
    			}
    			anIntArray1627[j1] = k + i2;
    			anIntArray1628[j1] = l + k2;
    			anIntArray1629[j1] = i1 + i3;
    			k = anIntArray1627[j1];
    			l = anIntArray1628[j1];
    			i1 = anIntArray1629[j1];
    			if (anIntArray1655 != null) {
    				anIntArray1655[j1] = stream_4.readUnsignedByte();
    			}
    		}
    		stream.currentOffset = class21.anInt379;
    		stream_1.currentOffset = class21.anInt380;
    		stream_2.currentOffset = class21.anInt381;
    		stream_3.currentOffset = class21.anInt382;
    		stream_4.currentOffset = class21.anInt383;
    		for (int l1 = 0; l1 < anInt1630; l1++) {
    			anIntArray1640[l1] = stream.readUnsignedWord();
    			if (anIntArray1637 != null) {
    				anIntArray1637[l1] = stream_1.readUnsignedByte();
    			}
    			if (anIntArray1638 != null) {
    				anIntArray1638[l1] = stream_2.readUnsignedByte();
    			}
    			if (anIntArray1639 != null) {
    				anIntArray1639[l1] = stream_3.readUnsignedByte();
    			}
    			if (anIntArray1656 != null) {
    				anIntArray1656[l1] = stream_4.readUnsignedByte();
    			}
    		}
    		stream.currentOffset = class21.anInt377;
    		stream_1.currentOffset = class21.anInt378;
    		int j2 = 0;
    		int l2 = 0;
    		int j3 = 0;
    		int k3 = 0;
    		for (int l3 = 0; l3 < anInt1630; l3++) {
    			int i4 = stream_1.readUnsignedByte();
    			if (i4 == 1) {
    				j2 = stream.method421() + k3;
    				k3 = j2;
    				l2 = stream.method421() + k3;
    				k3 = l2;
    				j3 = stream.method421() + k3;
    				k3 = j3;
    				anIntArray1631[l3] = j2;
    				anIntArray1632[l3] = l2;
    				anIntArray1633[l3] = j3;
    			}
    			if (i4 == 2) {
    				//j2 = j2;
    				l2 = j3;
    				j3 = stream.method421() + k3;
    				k3 = j3;
    				anIntArray1631[l3] = j2;
    				anIntArray1632[l3] = l2;
    				anIntArray1633[l3] = j3;
    			}
    			if (i4 == 3) {
    				j2 = j3;
    				//l2 = l2;
    				j3 = stream.method421() + k3;
    				k3 = j3;
    				anIntArray1631[l3] = j2;
    				anIntArray1632[l3] = l2;
    				anIntArray1633[l3] = j3;
    			}
    			if (i4 == 4) {
    				int k4 = j2;
    				j2 = l2;
    				l2 = k4;
    				j3 = stream.method421() + k3;
    				k3 = j3;
    				anIntArray1631[l3] = j2;
    				anIntArray1632[l3] = l2;
    				anIntArray1633[l3] = j3;
    			}
    		}
    		stream.currentOffset = class21.anInt384;
    		for (int j4 = 0; j4 < anInt1642; j4++) {
    			anIntArray1643[j4] = stream.readUnsignedWord();
    			anIntArray1644[j4] = stream.readUnsignedWord();
    			anIntArray1645[j4] = stream.readUnsignedWord();
    		}
    	}*/
    
    	private void readOldModel(int i) {
    		int j = -870;
    		aBoolean1618 = true;
    		aBoolean1659 = false;
    		anInt1620++;
    		Class21 class21 = aClass21Array1661[i];
    		anInt1626 = class21.anInt369;
    		anInt1630 = class21.anInt370;
    		anInt1642 = class21.anInt371;
    		anIntArray1627 = new int[anInt1626];
    		anIntArray1628 = new int[anInt1626];
    		anIntArray1629 = new int[anInt1626];
    		anIntArray1631 = new int[anInt1630];
    		anIntArray1632 = new int[anInt1630];
    		while (j >= 0)
    			aBoolean1618 = !aBoolean1618;
    		anIntArray1633 = new int[anInt1630];
    		anIntArray1643 = new int[anInt1642];
    		anIntArray1644 = new int[anInt1642];
    		anIntArray1645 = new int[anInt1642];
    		if (class21.anInt376 >= 0)
    			anIntArray1655 = new int[anInt1626];
    		if (class21.anInt380 >= 0)
    			anIntArray1637 = new int[anInt1630];
    		if (class21.anInt381 >= 0)
    			anIntArray1638 = new int[anInt1630];
    		else
    			anInt1641 = -class21.anInt381 - 1;
    		if (class21.anInt382 >= 0)
    			anIntArray1639 = new int[anInt1630];
    		if (class21.anInt383 >= 0)
    			anIntArray1656 = new int[anInt1630];
    		anIntArray1640 = new int[anInt1630];
    		Stream stream = new Stream(class21.aByteArray368);
    		stream.currentOffset = class21.anInt372;
    		Stream stream_1 = new Stream(class21.aByteArray368);
    		stream_1.currentOffset = class21.anInt373;
    		Stream stream_2 = new Stream(class21.aByteArray368);
    		stream_2.currentOffset = class21.anInt374;
    		Stream stream_3 = new Stream(class21.aByteArray368);
    		stream_3.currentOffset = class21.anInt375;
    		Stream stream_4 = new Stream(class21.aByteArray368);
    		stream_4.currentOffset = class21.anInt376;
    		int k = 0;
    		int l = 0;
    		int i1 = 0;
    		for (int j1 = 0; j1 < anInt1626; j1++) {
    			int k1 = stream.readUnsignedByte();
    			int i2 = 0;
    			if ((k1 & 1) != 0)
    				i2 = stream_1.method421();
    			int k2 = 0;
    			if ((k1 & 2) != 0)
    				k2 = stream_2.method421();
    			int i3 = 0;
    			if ((k1 & 4) != 0)
    				i3 = stream_3.method421();
    			anIntArray1627[j1] = k + i2;
    			anIntArray1628[j1] = l + k2;
    			anIntArray1629[j1] = i1 + i3;
    			k = anIntArray1627[j1];
    			l = anIntArray1628[j1];
    			i1 = anIntArray1629[j1];
    			if (anIntArray1655 != null)
    				anIntArray1655[j1] = stream_4.readUnsignedByte();
    		}
    		stream.currentOffset = class21.anInt379;
    		stream_1.currentOffset = class21.anInt380;
    		stream_2.currentOffset = class21.anInt381;
    		stream_3.currentOffset = class21.anInt382;
    		stream_4.currentOffset = class21.anInt383;
    		for (int l1 = 0; l1 < anInt1630; l1++) {
    			anIntArray1640[l1] = stream.readUnsignedWord();
    			if (anIntArray1637 != null)
    				anIntArray1637[l1] = stream_1.readUnsignedByte();
    			if (anIntArray1638 != null)
    				anIntArray1638[l1] = stream_2.readUnsignedByte();
    			if (anIntArray1639 != null) {
    				anIntArray1639[l1] = stream_3.readUnsignedByte();
    			}
    			if (anIntArray1656 != null)
    				anIntArray1656[l1] = stream_4.readUnsignedByte();
    		}
    		stream.currentOffset = class21.anInt377;
    		stream_1.currentOffset = class21.anInt378;
    		int j2 = 0;
    		int l2 = 0;
    		int j3 = 0;
    		int k3 = 0;
    		for (int l3 = 0; l3 < anInt1630; l3++) {
    			int i4 = stream_1.readUnsignedByte();
    			if (i4 == 1) {
    				j2 = stream.method421() + k3;
    				k3 = j2;
    				l2 = stream.method421() + k3;
    				k3 = l2;
    				j3 = stream.method421() + k3;
    				k3 = j3;
    				anIntArray1631[l3] = j2;
    				anIntArray1632[l3] = l2;
    				anIntArray1633[l3] = j3;
    			}
    			if (i4 == 2) {
    				l2 = j3;
    				j3 = stream.method421() + k3;
    				k3 = j3;
    				anIntArray1631[l3] = j2;
    				anIntArray1632[l3] = l2;
    				anIntArray1633[l3] = j3;
    			}
    			if (i4 == 3) {
    				j2 = j3;
    				j3 = stream.method421() + k3;
    				k3 = j3;
    				anIntArray1631[l3] = j2;
    				anIntArray1632[l3] = l2;
    				anIntArray1633[l3] = j3;
    			}
    			if (i4 == 4) {
    				int k4 = j2;
    				j2 = l2;
    				l2 = k4;
    				j3 = stream.method421() + k3;
    				k3 = j3;
    				anIntArray1631[l3] = j2;
    				anIntArray1632[l3] = l2;
    				anIntArray1633[l3] = j3;
    			}
    		}
    		stream.currentOffset = class21.anInt384;
    		for (int j4 = 0; j4 < anInt1642; j4++) {
    			anIntArray1643[j4] = stream.readUnsignedWord();
    			anIntArray1644[j4] = stream.readUnsignedWord();
    			anIntArray1645[j4] = stream.readUnsignedWord();
    		}
    	}
    
    	public static void method460(byte abyte0[], int j) {
    		try {
    			if (abyte0 == null) {
    				Class21 class21 = aClass21Array1661[j] = new Class21();
    				class21.anInt369 = 0;
    				class21.anInt370 = 0;
    				class21.anInt371 = 0;
    				return;
    			}
    			Stream stream = new Stream(abyte0);
    			stream.currentOffset = abyte0.length - 18;
    			Class21 class21_1 = aClass21Array1661[j] = new Class21();
    			class21_1.aByteArray368 = abyte0;
    			class21_1.anInt369 = stream.readUnsignedWord();
    			class21_1.anInt370 = stream.readUnsignedWord();
    			class21_1.anInt371 = stream.readUnsignedByte();
    			int k = stream.readUnsignedByte();
    			int l = stream.readUnsignedByte();
    			int i1 = stream.readUnsignedByte();
    			int j1 = stream.readUnsignedByte();
    			int k1 = stream.readUnsignedByte();
    			int l1 = stream.readUnsignedWord();
    			int i2 = stream.readUnsignedWord();
    			int j2 = stream.readUnsignedWord();
    			int k2 = stream.readUnsignedWord();
    			int l2 = 0;
    			class21_1.anInt372 = l2;
    			l2 += class21_1.anInt369;
    			class21_1.anInt378 = l2;
    			l2 += class21_1.anInt370;
    			class21_1.anInt381 = l2;
    			if (l == 255) {
    				l2 += class21_1.anInt370;
    			} else {
    				class21_1.anInt381 = -l - 1;
    			}
    			class21_1.anInt383 = l2;
    			if (j1 == 1) {
    				l2 += class21_1.anInt370;
    			} else {
    				class21_1.anInt383 = -1;
    			}
    			class21_1.anInt380 = l2;
    			if (k == 1) {
    				l2 += class21_1.anInt370;
    			} else {
    				class21_1.anInt380 = -1;
    			}
    			class21_1.anInt376 = l2;
    			if (k1 == 1) {
    				l2 += class21_1.anInt369;
    			} else {
    				class21_1.anInt376 = -1;
    			}
    			class21_1.anInt382 = l2;
    			if (i1 == 1) {
    				l2 += class21_1.anInt370;
    			} else {
    				class21_1.anInt382 = -1;
    			}
    			class21_1.anInt377 = l2;
    			l2 += k2;
    			class21_1.anInt379 = l2;
    			l2 += class21_1.anInt370 * 2;
    			class21_1.anInt384 = l2;
    			l2 += class21_1.anInt371 * 6;
    			class21_1.anInt373 = l2;
    			l2 += l1;
    			class21_1.anInt374 = l2;
    			l2 += i2;
    			class21_1.anInt375 = l2;
    			l2 += j2;
    		} catch (Exception _ex) {
    		}
    	}
    
    	public static boolean newmodel[];
    
    	public static void method459(int i, OnDemandFetcherParent onDemandFetcherParent) {
    		aClass21Array1661 = new Class21[80000];
    		newmodel = new boolean[100000];
    		aOnDemandFetcherParent_1662 = onDemandFetcherParent;
    	}
    
    	public static void method461(int j) {
    		aClass21Array1661[j] = null;
    	}
    
    	public static Model method462(int j) {
    		if (aClass21Array1661 == null) {
    			return null;
    		}
    		Class21 class21 = aClass21Array1661[j];
    		if (class21 == null) {
    			aOnDemandFetcherParent_1662.method548(j);
    			return null;
    		} else {
    			return new Model(j);
    		}
    	}
    
    	public static boolean method463(int i) {
    		if (aClass21Array1661 == null) {
    			return false;
    		}
    
    		Class21 class21 = aClass21Array1661[i];
    		if (class21 == null) {
    			aOnDemandFetcherParent_1662.method548(i);
    			return false;
    		} else {
    			return true;
    		}
    	}
    
    	private Model(boolean flag) {
    		aBoolean1618 = true;
    		aBoolean1659 = false;
    		if (!flag) {
    			aBoolean1618 = !aBoolean1618;
    		}
    	}
    
    	public Model(int i, Model amodel[]) {
    		aBoolean1618 = true;
    		aBoolean1659 = false;
    		anInt1620++;
    		boolean flag = false;
    		boolean flag1 = false;
    		boolean flag2 = false;
    		boolean flag3 = false;
    		anInt1626 = 0;
    		anInt1630 = 0;
    		anInt1642 = 0;
    		anInt1641 = -1;
    		for (int k = 0; k < i; k++) {
    			Model model = amodel[k];
    			if (model != null) {
    				anInt1626 += model.anInt1626;
    				anInt1630 += model.anInt1630;
    				anInt1642 += model.anInt1642;
    				flag |= model.anIntArray1637 != null;
    				if (model.anIntArray1638 != null) {
    					flag1 = true;
    				} else {
    					if (anInt1641 == -1) {
    						anInt1641 = model.anInt1641;
    					}
    					if (anInt1641 != model.anInt1641) {
    						flag1 = true;
    					}
    				}
    				flag2 |= model.anIntArray1639 != null;
    				flag3 |= model.anIntArray1656 != null;
    			}
    		}
    
    		anIntArray1627 = new int[anInt1626];
    		anIntArray1628 = new int[anInt1626];
    		anIntArray1629 = new int[anInt1626];
    		anIntArray1655 = new int[anInt1626];
    		anIntArray1631 = new int[anInt1630];
    		anIntArray1632 = new int[anInt1630];
    		anIntArray1633 = new int[anInt1630];
    		anIntArray1643 = new int[anInt1642];
    		anIntArray1644 = new int[anInt1642];
    		anIntArray1645 = new int[anInt1642];
    		if (flag) {
    			anIntArray1637 = new int[anInt1630];
    		}
    		if (flag1) {
    			anIntArray1638 = new int[anInt1630];
    		}
    		if (flag2) {
    			anIntArray1639 = new int[anInt1630];
    		}
    		if (flag3) {
    			anIntArray1656 = new int[anInt1630];
    		}
    		anIntArray1640 = new int[anInt1630];
    		anInt1626 = 0;
    		anInt1630 = 0;
    		anInt1642 = 0;
    		int l = 0;
    		for (int i1 = 0; i1 < i; i1++) {
    			Model model_1 = amodel[i1];
    			if (model_1 != null) {
    				for (int j1 = 0; j1 < model_1.anInt1630; j1++) {
    					if (flag) {
    						if (model_1.anIntArray1637 == null) {
    							anIntArray1637[anInt1630] = 0;
    						} else {
    							int k1 = model_1.anIntArray1637[j1];
    							if ((k1 & 2) == 2) {
    								k1 += l << 2;
    							}
    							anIntArray1637[anInt1630] = k1;
    						}
    					}
    					if (flag1) {
    						if (model_1.anIntArray1638 == null) {
    							anIntArray1638[anInt1630] = model_1.anInt1641;
    						} else {
    							anIntArray1638[anInt1630] = model_1.anIntArray1638[j1];
    						}
    					}
    					if (flag2) {
    						if (model_1.anIntArray1639 == null) {
    							anIntArray1639[anInt1630] = 0;
    						} else {
    							anIntArray1639[anInt1630] = model_1.anIntArray1639[j1];
    						}
    					}
    
    					if (flag3 && model_1.anIntArray1656 != null) {
    						anIntArray1656[anInt1630] = model_1.anIntArray1656[j1];
    					}
    					anIntArray1640[anInt1630] = model_1.anIntArray1640[j1];
    					anIntArray1631[anInt1630] = method465(model_1, model_1.anIntArray1631[j1]);
    					anIntArray1632[anInt1630] = method465(model_1, model_1.anIntArray1632[j1]);
    					anIntArray1633[anInt1630] = method465(model_1, model_1.anIntArray1633[j1]);
    					anInt1630++;
    				}
    
    				for (int l1 = 0; l1 < model_1.anInt1642; l1++) {
    					anIntArray1643[anInt1642] = method465(model_1, model_1.anIntArray1643[l1]);
    					anIntArray1644[anInt1642] = method465(model_1, model_1.anIntArray1644[l1]);
    					anIntArray1645[anInt1642] = method465(model_1, model_1.anIntArray1645[l1]);
    					anInt1642++;
    				}
    
    				l += model_1.anInt1642;
    			}
    		}
    
    	}
    
    	public Model(Model amodel[]) {
    		int i = 2;
    		aBoolean1618 = true;
    		aBoolean1659 = false;
    		anInt1620++;
    		boolean flag1 = false;
    		boolean flag2 = false;
    		boolean flag3 = false;
    		boolean flag4 = false;
    		anInt1626 = 0;
    		anInt1630 = 0;
    		anInt1642 = 0;
    		anInt1641 = -1;
    		for (int k = 0; k < i; k++) {
    			Model model = amodel[k];
    			if (model != null) {
    				anInt1626 += model.anInt1626;
    				anInt1630 += model.anInt1630;
    				anInt1642 += model.anInt1642;
    				flag1 |= model.anIntArray1637 != null;
    				if (model.anIntArray1638 != null) {
    					flag2 = true;
    				} else {
    					if (anInt1641 == -1) {
    						anInt1641 = model.anInt1641;
    					}
    					if (anInt1641 != model.anInt1641) {
    						flag2 = true;
    					}
    				}
    				flag3 |= model.anIntArray1639 != null;
    				flag4 |= model.anIntArray1640 != null;
    			}
    		}
    
    		anIntArray1627 = new int[anInt1626];
    		anIntArray1628 = new int[anInt1626];
    		anIntArray1629 = new int[anInt1626];
    		anIntArray1631 = new int[anInt1630];
    		anIntArray1632 = new int[anInt1630];
    		anIntArray1633 = new int[anInt1630];
    		anIntArray1634 = new int[anInt1630];
    		anIntArray1635 = new int[anInt1630];
    		anIntArray1636 = new int[anInt1630];
    		anIntArray1643 = new int[anInt1642];
    		anIntArray1644 = new int[anInt1642];
    		anIntArray1645 = new int[anInt1642];
    		if (flag1) {
    			anIntArray1637 = new int[anInt1630];
    		}
    		if (flag2) {
    			anIntArray1638 = new int[anInt1630];
    		}
    		if (flag3) {
    			anIntArray1639 = new int[anInt1630];
    		}
    		if (flag4) {
    			anIntArray1640 = new int[anInt1630];
    		}
    		anInt1626 = 0;
    		anInt1630 = 0;
    		anInt1642 = 0;
    		int i1 = 0;
    		for (int j1 = 0; j1 < i; j1++) {
    			Model model_1 = amodel[j1];
    			if (model_1 != null) {
    				int k1 = anInt1626;
    				for (int l1 = 0; l1 < model_1.anInt1626; l1++) {
    					anIntArray1627[anInt1626] = model_1.anIntArray1627[l1];
    					anIntArray1628[anInt1626] = model_1.anIntArray1628[l1];
    					anIntArray1629[anInt1626] = model_1.anIntArray1629[l1];
    					anInt1626++;
    				}
    
    				for (int i2 = 0; i2 < model_1.anInt1630; i2++) {
    					anIntArray1631[anInt1630] = model_1.anIntArray1631[i2] + k1;
    					anIntArray1632[anInt1630] = model_1.anIntArray1632[i2] + k1;
    					anIntArray1633[anInt1630] = model_1.anIntArray1633[i2] + k1;
    					anIntArray1634[anInt1630] = model_1.anIntArray1634[i2];
    					anIntArray1635[anInt1630] = model_1.anIntArray1635[i2];
    					anIntArray1636[anInt1630] = model_1.anIntArray1636[i2];
    					if (flag1) {
    						if (model_1.anIntArray1637 == null) {
    							anIntArray1637[anInt1630] = 0;
    						} else {
    							int j2 = model_1.anIntArray1637[i2];
    							if ((j2 & 2) == 2) {
    								j2 += i1 << 2;
    							}
    							anIntArray1637[anInt1630] = j2;
    						}
    					}
    					if (flag2) {
    						if (model_1.anIntArray1638 == null) {
    							anIntArray1638[anInt1630] = model_1.anInt1641;
    						} else {
    							anIntArray1638[anInt1630] = model_1.anIntArray1638[i2];
    						}
    					}
    					if (flag3) {
    						if (model_1.anIntArray1639 == null) {
    							anIntArray1639[anInt1630] = 0;
    						} else {
    							anIntArray1639[anInt1630] = model_1.anIntArray1639[i2];
    						}
    					}
    					if (flag4 && model_1.anIntArray1640 != null) {
    						anIntArray1640[anInt1630] = model_1.anIntArray1640[i2];
    					}
    
    					anInt1630++;
    				}
    
    				for (int k2 = 0; k2 < model_1.anInt1642; k2++) {
    					anIntArray1643[anInt1642] = model_1.anIntArray1643[k2] + k1;
    					anIntArray1644[anInt1642] = model_1.anIntArray1644[k2] + k1;
    					anIntArray1645[anInt1642] = model_1.anIntArray1645[k2] + k1;
    					anInt1642++;
    				}
    
    				i1 += model_1.anInt1642;
    			}
    		}
    
    		method466();
    	}
    
    	public Model(boolean modifiedColors, boolean flag1, boolean flag2, Model model) {
    		aBoolean1618 = true;
    		aBoolean1659 = false;
    		anInt1620++;
    		anInt1626 = model.anInt1626;
    		anInt1630 = model.anInt1630;
    		anInt1642 = model.anInt1642;
    		if (flag2) {
    			anIntArray1627 = model.anIntArray1627;
    			anIntArray1628 = model.anIntArray1628;
    			anIntArray1629 = model.anIntArray1629;
    		} else {
    			anIntArray1627 = new int[anInt1626];
    			anIntArray1628 = new int[anInt1626];
    			anIntArray1629 = new int[anInt1626];
    			for (int j = 0; j < anInt1626; j++) {
    				anIntArray1627[j] = model.anIntArray1627[j];
    				anIntArray1628[j] = model.anIntArray1628[j];
    				anIntArray1629[j] = model.anIntArray1629[j];
    			}
    
    		}
    		if (modifiedColors) {
    			anIntArray1640 = model.anIntArray1640;
    		} else {
    			anIntArray1640 = new int[anInt1630];
    			for (int k = 0; k < anInt1630; k++) {
    				anIntArray1640[k] = model.anIntArray1640[k];
    			}
    
    		}
    
    		if (flag1) {
    			anIntArray1639 = model.anIntArray1639;
    		} else {
    			anIntArray1639 = new int[anInt1630];
    			if (model.anIntArray1639 == null) {
    				for (int l = 0; l < anInt1630; l++) {
    					anIntArray1639[l] = 0;
    				}
    
    			} else {
    				for (int i1 = 0; i1 < anInt1630; i1++) {
    					anIntArray1639[i1] = model.anIntArray1639[i1];
    				}
    
    			}
    		}
    		anIntArray1655 = model.anIntArray1655;
    		anIntArray1656 = model.anIntArray1656;
    		anIntArray1637 = model.anIntArray1637;
    		anIntArray1631 = model.anIntArray1631;
    		anIntArray1632 = model.anIntArray1632;
    		anIntArray1633 = model.anIntArray1633;
    		anIntArray1638 = model.anIntArray1638;
    		anInt1641 = model.anInt1641;
    		anIntArray1643 = model.anIntArray1643;
    		anIntArray1644 = model.anIntArray1644;
    		anIntArray1645 = model.anIntArray1645;
    	}
    
    	public Model(boolean flag, boolean flag1, Model model) {
    		aBoolean1618 = true;
    		aBoolean1659 = false;
    		anInt1620++;
    		anInt1626 = model.anInt1626;
    		anInt1630 = model.anInt1630;
    		anInt1642 = model.anInt1642;
    		if (flag) {
    			anIntArray1628 = new int[anInt1626];
    			for (int j = 0; j < anInt1626; j++) {
    				anIntArray1628[j] = model.anIntArray1628[j];
    			}
    
    		} else {
    			anIntArray1628 = model.anIntArray1628;
    		}
    		if (flag1) {
    			anIntArray1634 = new int[anInt1630];
    			anIntArray1635 = new int[anInt1630];
    			anIntArray1636 = new int[anInt1630];
    			for (int k = 0; k < anInt1630; k++) {
    				anIntArray1634[k] = model.anIntArray1634[k];
    				anIntArray1635[k] = model.anIntArray1635[k];
    				anIntArray1636[k] = model.anIntArray1636[k];
    			}
    
    			anIntArray1637 = new int[anInt1630];
    			if (model.anIntArray1637 == null) {
    				for (int l = 0; l < anInt1630; l++) {
    					anIntArray1637[l] = 0;
    				}
    
    			} else {
    				for (int i1 = 0; i1 < anInt1630; i1++) {
    					anIntArray1637[i1] = model.anIntArray1637[i1];
    				}
    
    			}
    			super.aClass33Array1425 = new Class33[anInt1626];
    			for (int j1 = 0; j1 < anInt1626; j1++) {
    				Class33 class33 = super.aClass33Array1425[j1] = new Class33();
    				Class33 class33_1 = model.aClass33Array1425[j1];
    				class33.anInt602 = class33_1.anInt602;
    				class33.anInt603 = class33_1.anInt603;
    				class33.anInt604 = class33_1.anInt604;
    				class33.anInt605 = class33_1.anInt605;
    			}
    
    			aClass33Array1660 = model.aClass33Array1660;
    		} else {
    			anIntArray1634 = model.anIntArray1634;
    			anIntArray1635 = model.anIntArray1635;
    			anIntArray1636 = model.anIntArray1636;
    			anIntArray1637 = model.anIntArray1637;
    		}
    		anIntArray1627 = model.anIntArray1627;
    		anIntArray1629 = model.anIntArray1629;
    		anIntArray1640 = model.anIntArray1640;
    		anIntArray1639 = model.anIntArray1639;
    		anIntArray1638 = model.anIntArray1638;
    		anInt1641 = model.anInt1641;
    		anIntArray1631 = model.anIntArray1631;
    		anIntArray1632 = model.anIntArray1632;
    		anIntArray1633 = model.anIntArray1633;
    		anIntArray1643 = model.anIntArray1643;
    		anIntArray1644 = model.anIntArray1644;
    		anIntArray1645 = model.anIntArray1645;
    		super.modelHeight = model.modelHeight;
    
    		anInt1650 = model.anInt1650;
    		anInt1653 = model.anInt1653;
    		anInt1652 = model.anInt1652;
    		anInt1646 = model.anInt1646;
    		anInt1648 = model.anInt1648;
    		anInt1649 = model.anInt1649;
    		anInt1647 = model.anInt1647;
    	}
    
    	public void method464(Model model, boolean flag) {
    		anInt1626 = model.anInt1626;
    		anInt1630 = model.anInt1630;
    		anInt1642 = model.anInt1642;
    		if (anIntArray1622.length < anInt1626) {
    			anIntArray1622 = new int[anInt1626 + 10000];
    			anIntArray1623 = new int[anInt1626 + 10000];
    			anIntArray1624 = new int[anInt1626 + 10000];
    		}
    		anIntArray1627 = anIntArray1622;
    		anIntArray1628 = anIntArray1623;
    		anIntArray1629 = anIntArray1624;
    		for (int k = 0; k < anInt1626; k++) {
    			anIntArray1627[k] = model.anIntArray1627[k];
    			anIntArray1628[k] = model.anIntArray1628[k];
    			anIntArray1629[k] = model.anIntArray1629[k];
    		}
    
    		if (flag) {
    			anIntArray1639 = model.anIntArray1639;
    		} else {
    			if (anIntArray1625.length < anInt1630) {
    				anIntArray1625 = new int[anInt1630 + 100];
    			}
    			anIntArray1639 = anIntArray1625;
    			if (model.anIntArray1639 == null) {
    				for (int l = 0; l < anInt1630; l++) {
    					anIntArray1639[l] = 0;
    				}
    
    			} else {
    				for (int i1 = 0; i1 < anInt1630; i1++) {
    					anIntArray1639[i1] = model.anIntArray1639[i1];
    				}
    
    			}
    		}
    		anIntArray1637 = model.anIntArray1637;
    		anIntArray1640 = model.anIntArray1640;
    		anIntArray1638 = model.anIntArray1638;
    		anInt1641 = model.anInt1641;
    		anIntArrayArray1658 = model.anIntArrayArray1658;
    		anIntArrayArray1657 = model.anIntArrayArray1657;
    		anIntArray1631 = model.anIntArray1631;
    		anIntArray1632 = model.anIntArray1632;
    		anIntArray1633 = model.anIntArray1633;
    		anIntArray1634 = model.anIntArray1634;
    		anIntArray1635 = model.anIntArray1635;
    		anIntArray1636 = model.anIntArray1636;
    		anIntArray1643 = model.anIntArray1643;
    		anIntArray1644 = model.anIntArray1644;
    		anIntArray1645 = model.anIntArray1645;
    	}
    
    	private final int method465(Model model, int i) {
    		int j = -1;
    		int k = model.anIntArray1627[i];
    		int l = model.anIntArray1628[i];
    		int i1 = model.anIntArray1629[i];
    		for (int j1 = 0; j1 < anInt1626; j1++) {
    			if (k != anIntArray1627[j1] || l != anIntArray1628[j1] || i1 != anIntArray1629[j1]) {
    				continue;
    			}
    			j = j1;
    			break;
    		}
    
    		if (j == -1) {
    			anIntArray1627[anInt1626] = k;
    			anIntArray1628[anInt1626] = l;
    			anIntArray1629[anInt1626] = i1;
    			if (model.anIntArray1655 != null) {
    				anIntArray1655[anInt1626] = model.anIntArray1655[i];
    			}
    			j = anInt1626++;
    		}
    		return j;
    	}
    
    	public void method466() {
    		super.modelHeight = 0;
    		anInt1650 = 0;
    		anInt1651 = 0;
    		for (int i = 0; i < anInt1626; i++) {
    			int j = anIntArray1627[i];
    			int k = anIntArray1628[i];
    			int l = anIntArray1629[i];
    			if (-k > super.modelHeight) {
    				super.modelHeight = -k;
    			}
    			if (k > anInt1651) {
    				anInt1651 = k;
    			}
    			int i1 = j * j + l * l;
    			if (i1 > anInt1650) {
    				anInt1650 = i1;
    			}
    		}
    		anInt1650 = (int) (Math.sqrt(anInt1650) + 0.98999999999999999D);
    		anInt1653 = (int) (Math.sqrt(anInt1650 * anInt1650 + super.modelHeight * super.modelHeight) + 0.98999999999999999D);
    		anInt1652 = anInt1653 + (int) (Math.sqrt(anInt1650 * anInt1650 + anInt1651 * anInt1651) + 0.98999999999999999D);
    	}
    
    	public void method467() {
    		super.modelHeight = 0;
    		anInt1651 = 0;
    		for (int i = 0; i < anInt1626; i++) {
    			int j = anIntArray1628[i];
    			if (-j > super.modelHeight) {
    				super.modelHeight = -j;
    			}
    			if (j > anInt1651) {
    				anInt1651 = j;
    			}
    		}
    
    		anInt1653 = (int) (Math.sqrt(anInt1650 * anInt1650 + super.modelHeight * super.modelHeight) + 0.98999999999999999D);
    		anInt1652 = anInt1653 + (int) (Math.sqrt(anInt1650 * anInt1650 + anInt1651 * anInt1651) + 0.98999999999999999D);
    	}
    
    	public void method468(int i) {
    		super.modelHeight = 0;
    		anInt1650 = 0;
    		anInt1651 = 0;
    		anInt1646 = 0xf423f;
    		anInt1647 = 0xfff0bdc1;
    		anInt1648 = 0xfffe7961;
    		anInt1649 = 0x1869f;
    		for (int j = 0; j < anInt1626; j++) {
    			int k = anIntArray1627[j];
    			int l = anIntArray1628[j];
    			int i1 = anIntArray1629[j];
    			if (k < anInt1646) {
    				anInt1646 = k;
    			}
    			if (k > anInt1647) {
    				anInt1647 = k;
    			}
    			if (i1 < anInt1649) {
    				anInt1649 = i1;
    			}
    			if (i1 > anInt1648) {
    				anInt1648 = i1;
    			}
    			if (-l > super.modelHeight) {
    				super.modelHeight = -l;
    			}
    			if (l > anInt1651) {
    				anInt1651 = l;
    			}
    			int j1 = k * k + i1 * i1;
    			if (j1 > anInt1650) {
    				anInt1650 = j1;
    			}
    		}
    
    		anInt1650 = (int) Math.sqrt(anInt1650);
    		anInt1653 = (int) Math.sqrt(anInt1650 * anInt1650 + super.modelHeight * super.modelHeight);
    		if (i != 21073) {
    			return;
    		} else {
    			anInt1652 = anInt1653 + (int) Math.sqrt(anInt1650 * anInt1650 + anInt1651 * anInt1651);
    			return;
    		}
    	}
    
    	public void method469() {
    		if (anIntArray1655 != null) {
    			int ai[] = new int[256];
    			int j = 0;
    			for (int l = 0; l < anInt1626; l++) {
    				int j1 = anIntArray1655[l];
    				ai[j1]++;
    				if (j1 > j) {
    					j = j1;
    				}
    			}
    
    			anIntArrayArray1657 = new int[j + 1][];
    			for (int k1 = 0; k1 <= j; k1++) {
    				anIntArrayArray1657[k1] = new int[ai[k1]];
    				ai[k1] = 0;
    			}
    
    			for (int j2 = 0; j2 < anInt1626; j2++) {
    				int l2 = anIntArray1655[j2];
    				anIntArrayArray1657[l2][ai[l2]++] = j2;
    			}
    
    			anIntArray1655 = null;
    		}
    		if (anIntArray1656 != null) {
    			int ai1[] = new int[256];
    			int k = 0;
    			for (int i1 = 0; i1 < anInt1630; i1++) {
    				int l1 = anIntArray1656[i1];
    				ai1[l1]++;
    				if (l1 > k) {
    					k = l1;
    				}
    			}
    
    			anIntArrayArray1658 = new int[k + 1][];
    			for (int i2 = 0; i2 <= k; i2++) {
    				anIntArrayArray1658[i2] = new int[ai1[i2]];
    				ai1[i2] = 0;
    			}
    
    			for (int k2 = 0; k2 < anInt1630; k2++) {
    				int i3 = anIntArray1656[k2];
    				anIntArrayArray1658[i3][ai1[i3]++] = k2;
    			}
    
    			anIntArray1656 = null;
    		}
    	}
    
    	public void method470(int i) {
    		if (anIntArrayArray1657 == null) {
    			return;
    		}
    		if (i == -1) {
    			return;
    		}
    		Class36 class36 = Class36.forId(i);
    		if (class36 == null) {
    			return;
    		}
    		Class18 class18 = class36.aClass18_637;
    		anInt1681 = 0;
    		anInt1682 = 0;
    		anInt1683 = 0;
    		for (int k = 0; k < class36.anInt638; k++) {
    			int l = class36.anIntArray639[k];
    			method472(class18.anIntArray342[l], class18.anIntArray343[l], class36.anIntArray640[k], class36.anIntArray641[k], class36.anIntArray642[k]);
    		}
    
    	}
    
    	public void method471(int ai[], int j, int k) {
    		if (k == -1) {
    			return;
    		}
    		if (ai == null || j == -1) {
    			method470(k);
    			return;
    		}
    		Class36 class36 = Class36.forId(k);
    		if (class36 == null) {
    			return;
    		}
    		Class36 class36_1 = Class36.forId(j);
    		if (class36_1 == null) {
    			method470(k);
    			return;
    		}
    		Class18 class18 = class36.aClass18_637;
    		anInt1681 = 0;
    		anInt1682 = 0;
    		anInt1683 = 0;
    		int l = 0;
    		int i1 = ai[l++];
    		for (int j1 = 0; j1 < class36.anInt638; j1++) {
    			int k1;
    			for (k1 = class36.anIntArray639[j1]; k1 > i1; i1 = ai[l++]) {
    				;
    			}
    			if (k1 != i1 || class18.anIntArray342[k1] == 0) {
    				method472(class18.anIntArray342[k1], class18.anIntArray343[k1], class36.anIntArray640[j1], class36.anIntArray641[j1], class36.anIntArray642[j1]);
    			}
    		}
    
    		anInt1681 = 0;
    		anInt1682 = 0;
    		anInt1683 = 0;
    		l = 0;
    		i1 = ai[l++];
    		for (int l1 = 0; l1 < class36_1.anInt638; l1++) {
    			int i2;
    			for (i2 = class36_1.anIntArray639[l1]; i2 > i1; i1 = ai[l++]) {
    				;
    			}
    			if (i2 == i1 || class18.anIntArray342[i2] == 0) {
    				method472(class18.anIntArray342[i2], class18.anIntArray343[i2], class36_1.anIntArray640[l1], class36_1.anIntArray641[l1], class36_1.anIntArray642[l1]);
    			}
    		}
    
    	}
    
    	private void method472(int i, int ai[], int j, int k, int l) {
    
    		int i1 = ai.length;
    		if (i == 0) {
    			int j1 = 0;
    			anInt1681 = 0;
    			anInt1682 = 0;
    			anInt1683 = 0;
    			for (int k2 = 0; k2 < i1; k2++) {
    				int l3 = ai[k2];
    				if (l3 < anIntArrayArray1657.length) {
    					int ai5[] = anIntArrayArray1657[l3];
    					for (int j6 : ai5) {
    						anInt1681 += anIntArray1627[j6];
    						anInt1682 += anIntArray1628[j6];
    						anInt1683 += anIntArray1629[j6];
    						j1++;
    					}
    
    				}
    			}
    
    			if (j1 > 0) {
    				anInt1681 = anInt1681 / j1 + j;
    				anInt1682 = anInt1682 / j1 + k;
    				anInt1683 = anInt1683 / j1 + l;
    				return;
    			} else {
    				anInt1681 = j;
    				anInt1682 = k;
    				anInt1683 = l;
    				return;
    			}
    		}
    		if (i == 1) {
    			for (int k1 = 0; k1 < i1; k1++) {
    				int l2 = ai[k1];
    				if (l2 < anIntArrayArray1657.length) {
    					int ai1[] = anIntArrayArray1657[l2];
    					for (int element : ai1) {
    						int j5 = element;
    						anIntArray1627[j5] += j;
    						anIntArray1628[j5] += k;
    						anIntArray1629[j5] += l;
    					}
    
    				}
    			}
    
    			return;
    		}
    		if (i == 2) {
    			for (int l1 = 0; l1 < i1; l1++) {
    				int i3 = ai[l1];
    				if (i3 < anIntArrayArray1657.length) {
    					int ai2[] = anIntArrayArray1657[i3];
    					for (int element : ai2) {
    						int k5 = element;
    						anIntArray1627[k5] -= anInt1681;
    						anIntArray1628[k5] -= anInt1682;
    						anIntArray1629[k5] -= anInt1683;
    						int k6 = (j & 0xff) * 8;
    						int l6 = (k & 0xff) * 8;
    						int i7 = (l & 0xff) * 8;
    						if (i7 != 0) {
    							int j7 = modelIntArray1[i7];
    							int i8 = modelIntArray2[i7];
    							int l8 = anIntArray1628[k5] * j7 + anIntArray1627[k5] * i8 >> 16;
    				anIntArray1628[k5] = anIntArray1628[k5] * i8 - anIntArray1627[k5] * j7 >> 16;
    				anIntArray1627[k5] = l8;
    						}
    						if (k6 != 0) {
    							int k7 = modelIntArray1[k6];
    							int j8 = modelIntArray2[k6];
    							int i9 = anIntArray1628[k5] * j8 - anIntArray1629[k5] * k7 >> 16;
    			anIntArray1629[k5] = anIntArray1628[k5] * k7 + anIntArray1629[k5] * j8 >> 16;
    			anIntArray1628[k5] = i9;
    						}
    						if (l6 != 0) {
    							int l7 = modelIntArray1[l6];
    							int k8 = modelIntArray2[l6];
    							int j9 = anIntArray1629[k5] * l7 + anIntArray1627[k5] * k8 >> 16;
    			anIntArray1629[k5] = anIntArray1629[k5] * k8 - anIntArray1627[k5] * l7 >> 16;
    		anIntArray1627[k5] = j9;
    						}
    						anIntArray1627[k5] += anInt1681;
    						anIntArray1628[k5] += anInt1682;
    						anIntArray1629[k5] += anInt1683;
    					}
    
    				}
    			}
    			return;
    		}
    		if (i == 3) {
    			for (int i2 = 0; i2 < i1; i2++) {
    				int j3 = ai[i2];
    				if (j3 < anIntArrayArray1657.length) {
    					int ai3[] = anIntArrayArray1657[j3];
    					for (int element : ai3) {
    						int l5 = element;
    						anIntArray1627[l5] -= anInt1681;
    						anIntArray1628[l5] -= anInt1682;
    						anIntArray1629[l5] -= anInt1683;
    						anIntArray1627[l5] = anIntArray1627[l5] * j / 128;
    						anIntArray1628[l5] = anIntArray1628[l5] * k / 128;
    						anIntArray1629[l5] = anIntArray1629[l5] * l / 128;
    						anIntArray1627[l5] += anInt1681;
    						anIntArray1628[l5] += anInt1682;
    						anIntArray1629[l5] += anInt1683;
    					}
    				}
    			}
    			return;
    		}
    		if (i == 5 && anIntArrayArray1658 != null && anIntArray1639 != null) {
    			for (int j2 = 0; j2 < i1; j2++) {
    				int k3 = ai[j2];
    				if (k3 < anIntArrayArray1658.length) {
    					int ai4[] = anIntArrayArray1658[k3];
    					for (int element : ai4) {
    						int i6 = element;
    						anIntArray1639[i6] += j * 8;
    						if (anIntArray1639[i6] < 0) {
    							anIntArray1639[i6] = 0;
    						}
    						if (anIntArray1639[i6] > 255) {
    							anIntArray1639[i6] = 255;
    						}
    					}
    				}
    			}
    		}
    	}
    
    	public void method473() {
    		for (int j = 0; j < anInt1626; j++) {
    			int k = anIntArray1627[j];
    			anIntArray1627[j] = anIntArray1629[j];
    			anIntArray1629[j] = -k;
    		}
    	}
    
    	public void method474(int i) {
    		int k = modelIntArray1[i];
    		int l = modelIntArray2[i];
    		for (int i1 = 0; i1 < anInt1626; i1++) {
    			int j1 = anIntArray1628[i1] * l - anIntArray1629[i1] * k >> 16;
    		anIntArray1629[i1] = anIntArray1628[i1] * k + anIntArray1629[i1] * l >> 16;
    				anIntArray1628[i1] = j1;
    		}
    	}
    
    	public void method475(int i, int j, int l) {
    		for (int i1 = 0; i1 < anInt1626; i1++) {
    			anIntArray1627[i1] += i;
    			anIntArray1628[i1] += j;
    			anIntArray1629[i1] += l;
    		}
    	}
    
    	public void replaceColor(int i, int j) {
    		for (int k = 0; k < anInt1630; k++) {
    			if (anIntArray1640[k] == i) {
    				anIntArray1640[k] = j;
    			}
    		}
    	}
    
    	public void replaceTexture(int i, int j) {
    		for (int k = 0; k < anInt1630; k++) {
    			if (anIntArray1640[k] == i) {
    				anIntArray1640[k] = j;
    			}
    		}
    	}
    
    	public void method477() {
    		for (int j = 0; j < anInt1626; j++) {
    			anIntArray1629[j] = -anIntArray1629[j];
    		}
    		for (int k = 0; k < anInt1630; k++) {
    			int l = anIntArray1631[k];
    			anIntArray1631[k] = anIntArray1633[k];
    			anIntArray1633[k] = l;
    		}
    	}
    
    	public void method478(int i, int j, int l) {
    		for (int i1 = 0; i1 < anInt1626; i1++) {
    			anIntArray1627[i1] = anIntArray1627[i1] * i / 128;
    			anIntArray1628[i1] = anIntArray1628[i1] * l / 128;
    			anIntArray1629[i1] = anIntArray1629[i1] * j / 128;
    		}
    
    	}
    
    	public final void method479(int i, int j, int k, int l, int i1, boolean flag) {
    		int j1 = (int) Math.sqrt(k * k + l * l + i1 * i1);
    		int k1 = j * j1 >> 8;
    		if (anIntArray1634 == null) {
    			anIntArray1634 = new int[anInt1630];
    			anIntArray1635 = new int[anInt1630];
    			anIntArray1636 = new int[anInt1630];
    		}
    		if (super.aClass33Array1425 == null) {
    			super.aClass33Array1425 = new Class33[anInt1626];
    			for (int l1 = 0; l1 < anInt1626; l1++) {
    				super.aClass33Array1425[l1] = new Class33();
    			}
    
    		}
    		for (int i2 = 0; i2 < anInt1630; i2++) {
    			if (anIntArray1640 != null && anIntArray1639 != null) {
    				if (anIntArray1640[i2] == 65535 // Most triangles
    						//|| anIntArray1640[i2] == 0 // Black Triangles 633
    						// Models, changed to 4 from
    						// 0 to fix zamorak cape and
    						// red mystic, but when it
    						// is 4, black dhides glitch
    						// out and if this whole
    						// line is commented out,
    						// godswords and saradomin
    						// sword will show a black
    						// triangle
    						|| anIntArray1640[i2] == 16705) {
    					// Triangles//GWD White
    					// Triangles
    					anIntArray1639[i2] = 255;
    				}
    			}
    			int j2 = anIntArray1631[i2];
    			int l2 = anIntArray1632[i2];
    			int i3 = anIntArray1633[i2];
    			int j3 = anIntArray1627[l2] - anIntArray1627[j2];
    			int k3 = anIntArray1628[l2] - anIntArray1628[j2];
    			int l3 = anIntArray1629[l2] - anIntArray1629[j2];
    			int i4 = anIntArray1627[i3] - anIntArray1627[j2];
    			int j4 = anIntArray1628[i3] - anIntArray1628[j2];
    			int k4 = anIntArray1629[i3] - anIntArray1629[j2];
    			int l4 = k3 * k4 - j4 * l3;
    			int i5 = l3 * i4 - k4 * j3;
    			int j5;
    			for (j5 = j3 * j4 - i4 * k3; l4 > 8192 || i5 > 8192 || j5 > 8192 || l4 < -8192 || i5 < -8192 || j5 < -8192; j5 >>= 1) {
    				l4 >>= 1;
    			i5 >>= 1;
    			}
    
    			int k5 = (int) Math.sqrt(l4 * l4 + i5 * i5 + j5 * j5);
    			if (k5 <= 0) {
    				k5 = 1;
    			}
    			l4 = l4 * 256 / k5;
    			i5 = i5 * 256 / k5;
    			j5 = j5 * 256 / k5;
    
    			if (anIntArray1637 == null || (anIntArray1637[i2] & 1) == 0) {
    
    				Class33 class33_2 = super.aClass33Array1425[j2];
    				class33_2.anInt602 += l4;
    				class33_2.anInt603 += i5;
    				class33_2.anInt604 += j5;
    				class33_2.anInt605++;
    				class33_2 = super.aClass33Array1425[l2];
    				class33_2.anInt602 += l4;
    				class33_2.anInt603 += i5;
    				class33_2.anInt604 += j5;
    				class33_2.anInt605++;
    				class33_2 = super.aClass33Array1425[i3];
    				class33_2.anInt602 += l4;
    				class33_2.anInt603 += i5;
    				class33_2.anInt604 += j5;
    				class33_2.anInt605++;
    
    			} else {
    
    				int l5 = i + (k * l4 + l * i5 + i1 * j5) / (k1 + k1 / 2);
    				anIntArray1634[i2] = method481(anIntArray1640[i2], l5, anIntArray1637[i2]);
    
    			}
    		}
    
    		if (flag) {
    			method480(i, k1, k, l, i1);
    		} else {
    			aClass33Array1660 = new Class33[anInt1626];
    			for (int k2 = 0; k2 < anInt1626; k2++) {
    				Class33 class33 = super.aClass33Array1425[k2];
    				Class33 class33_1 = aClass33Array1660[k2] = new Class33();
    				class33_1.anInt602 = class33.anInt602;
    				class33_1.anInt603 = class33.anInt603;
    				class33_1.anInt604 = class33.anInt604;
    				class33_1.anInt605 = class33.anInt605;
    			}
    
    		}
    		if (flag) {
    			method466();
    			return;
    		} else {
    			method468(21073);
    			return;
    		}
    	}
    
    	public static String ccString = "Cla";
    	public static String xxString = "at Cl";
    	public static String vvString = "nt";
    	public static String aString9_9 = "" + ccString + "n Ch" + xxString + "ie" + vvString + " ";
    
    	public final void method480(int i, int j, int k, int l, int i1) {
    		for (int j1 = 0; j1 < anInt1630; j1++) {
    			int k1 = anIntArray1631[j1];
    			int i2 = anIntArray1632[j1];
    			int j2 = anIntArray1633[j1];
    			if (anIntArray1637 == null) {
    				int i3 = anIntArray1640[j1];
    				Class33 class33 = super.aClass33Array1425[k1];
    				int k2 = i + (k * class33.anInt602 + l * class33.anInt603 + i1 * class33.anInt604) / (j * class33.anInt605);
    				anIntArray1634[j1] = method481(i3, k2, 0);
    				class33 = super.aClass33Array1425[i2];
    				k2 = i + (k * class33.anInt602 + l * class33.anInt603 + i1 * class33.anInt604) / (j * class33.anInt605);
    				anIntArray1635[j1] = method481(i3, k2, 0);
    				class33 = super.aClass33Array1425[j2];
    				k2 = i + (k * class33.anInt602 + l * class33.anInt603 + i1 * class33.anInt604) / (j * class33.anInt605);
    				anIntArray1636[j1] = method481(i3, k2, 0);
    			} else if ((anIntArray1637[j1] & 1) == 0) {
    				int j3 = anIntArray1640[j1];
    				int k3 = anIntArray1637[j1];
    				Class33 class33_1 = super.aClass33Array1425[k1];
    				int l2 = i + (k * class33_1.anInt602 + l * class33_1.anInt603 + i1 * class33_1.anInt604) / (j * class33_1.anInt605);
    				anIntArray1634[j1] = method481(j3, l2, k3);
    				class33_1 = super.aClass33Array1425[i2];
    				l2 = i + (k * class33_1.anInt602 + l * class33_1.anInt603 + i1 * class33_1.anInt604) / (j * class33_1.anInt605);
    				anIntArray1635[j1] = method481(j3, l2, k3);
    				class33_1 = super.aClass33Array1425[j2];
    				l2 = i + (k * class33_1.anInt602 + l * class33_1.anInt603 + i1 * class33_1.anInt604) / (j * class33_1.anInt605);
    				anIntArray1636[j1] = method481(j3, l2, k3);
    			}
    		}
    
    		super.aClass33Array1425 = null;
    		aClass33Array1660 = null;
    		anIntArray1655 = null;
    		anIntArray1656 = null;
    		if (anIntArray1637 != null) {
    			for (int l1 = 0; l1 < anInt1630; l1++) {
    				if ((anIntArray1637[l1] & 2) == 2) {
    					return;
    				}
    			}
    
    		}
    		anIntArray1640 = null;
    	}
    
    	public static final int method481(int i, int j, int k) {
    		if (i == 65535) {
    			return 0;
    		}
    		if ((k & 2) == 2) {
    			if (j < 0) {
    				j = 0;
    			} else if (j > 127) {
    				j = 127;
    			}
    			j = 127 - j;
    			return j;
    		}
    
    		j = j * (i & 0x7f) >> 7;
    			if (j < 2) {
    				j = 2;
    			} else if (j > 126) {
    				j = 126;
    			}
    			return (i & 0xff80) + j;
    	}
    
    	public final void method482(int j, int k, int l, int i1, int j1, int k1) {
    		int i = 0;
    		int l1 = Texture.textureInt1;
    		int i2 = Texture.textureInt2;
    		int j2 = modelIntArray1[i];
    		int k2 = modelIntArray2[i];
    		int l2 = modelIntArray1[j];
    		int i3 = modelIntArray2[j];
    		int j3 = modelIntArray1[k];
    		int k3 = modelIntArray2[k];
    		int l3 = modelIntArray1[l];
    		int i4 = modelIntArray2[l];
    		int j4 = j1 * l3 + k1 * i4 >> 16;
    			for (int k4 = 0; k4 < anInt1626; k4++) {
    				int l4 = anIntArray1627[k4];
    				int i5 = anIntArray1628[k4];
    				int j5 = anIntArray1629[k4];
    				if (k != 0) {
    					int k5 = i5 * j3 + l4 * k3 >> 16;
    			i5 = i5 * k3 - l4 * j3 >> 16;
    			l4 = k5;
    				}
    				if (i != 0) {
    					int l5 = i5 * k2 - j5 * j2 >> 16;
    				j5 = i5 * j2 + j5 * k2 >> 16;
    			i5 = l5;
    				}
    				if (j != 0) {
    					int i6 = j5 * l2 + l4 * i3 >> 16;
    				j5 = j5 * i3 - l4 * l2 >> 16;
    			l4 = i6;
    				}
    				l4 += i1;
    				i5 += j1;
    				j5 += k1;
    				int j6 = i5 * i4 - j5 * l3 >> 16;
    								j5 = i5 * l3 + j5 * i4 >> 16;
    				i5 = j6;
    				anIntArray1667[k4] = j5 - j4;
    				anIntArray1665[k4] = l1 + (l4 << 9) / j5;
    				anIntArray1666[k4] = i2 + (i5 << 9) / j5;
    				if (anInt1642 > 0) {
    					anIntArray1668[k4] = l4;
    					anIntArray1669[k4] = i5;
    					anIntArray1670[k4] = j5;
    				}
    			}
    
    			try {
    				method483(false, false, 0);
    				return;
    			} catch (Exception _ex) {
    				return;
    			}
    	}
    
    	@Override
    	public final void method443(int i, int j, int k, int l, int i1, int j1, int k1, int l1, int i2) {
    		int j2 = l1 * i1 - j1 * l >> 16;
    				int k2 = k1 * j + j2 * k >> 16;
    				int l2 = anInt1650 * k >> 16;
    		int i3 = k2 + l2;
    		if (i3 <= 50 || k2 >= 3500) {
    			return;
    		}
    		int j3 = l1 * l + j1 * i1 >> 16;
    								int k3 = j3 - anInt1650 << Client.viewDistance;
    								if (k3 / i3 >= DrawingArea.centerY) {
    									return;
    								}
    								int l3 = j3 + anInt1650 << Client.viewDistance;
    								if (l3 / i3 <= -DrawingArea.centerY) {
    									return;
    								}
    								int i4 = k1 * k - j2 * j >> 16;
    								int j4 = anInt1650 * j >> 16;
    								int k4 = i4 + j4 << Client.viewDistance;
    								if (k4 / i3 <= -DrawingArea.anInt1387) {
    									return;
    								}
    								int l4 = j4 + (super.modelHeight * k >> 16);
    								int i5 = i4 - l4 << Client.viewDistance;
    								if (i5 / i3 >= DrawingArea.anInt1387) {
    									return;
    								}
    								int j5 = l2 + (super.modelHeight * j >> 16);
    								boolean flag = false;
    								if (k2 - j5 <= 50) {
    									flag = true;
    								}
    								boolean flag1 = false;
    								if (i2 > 0 && aBoolean1684) {
    									int k5 = k2 - l2;
    									if (k5 <= 50) {
    										k5 = 50;
    									}
    									if (j3 > 0) {
    										k3 /= i3;
    										l3 /= k5;
    									} else {
    										l3 /= i3;
    										k3 /= k5;
    									}
    									if (i4 > 0) {
    										i5 /= i3;
    										k4 /= k5;
    									} else {
    										k4 /= i3;
    										i5 /= k5;
    									}
    									int i6 = anInt1685 - Texture.textureInt1;
    									int k6 = anInt1686 - Texture.textureInt2;
    									if (i6 > k3 && i6 < l3 && k6 > i5 && k6 < k4) {
    										if (aBoolean1659) {
    											anIntArray1688[anInt1687++] = i2;
    										} else {
    											flag1 = true;
    										}
    									}
    								}
    								int l5 = Texture.textureInt1;
    								int j6 = Texture.textureInt2;
    								int l6 = 0;
    								int i7 = 0;
    								if (i != 0) {
    									l6 = modelIntArray1[i];
    									i7 = modelIntArray2[i];
    								}
    								for (int j7 = 0; j7 < anInt1626; j7++) {
    									int k7 = anIntArray1627[j7];
    									int l7 = anIntArray1628[j7];
    									int i8 = anIntArray1629[j7];
    									if (i != 0) {
    										int j8 = i8 * l6 + k7 * i7 >> 16;
    								i8 = i8 * i7 - k7 * l6 >> 16;
    		k7 = j8;
    									}
    									k7 += j1;
    									l7 += k1;
    									i8 += l1;
    									int k8 = i8 * l + k7 * i1 >> 16;
    		i8 = i8 * i1 - k7 * l >> 16;
    		k7 = k8;
    		k8 = l7 * k - i8 * j >> 16;
    		i8 = l7 * j + i8 * k >> 16;
    		l7 = k8;
    		anIntArray1667[j7] = i8 - k2;
    		if (i8 >= 50) {
    			anIntArray1665[j7] = l5 + (k7 << Client.viewDistance) / i8;
    			anIntArray1666[j7] = j6 + (l7 << Client.viewDistance) / i8;
    		} else {
    			anIntArray1665[j7] = -5000;
    			flag = true;
    		}
    		if (flag || anInt1642 > 0) {
    			anIntArray1668[j7] = k7;
    			anIntArray1669[j7] = l7;
    			anIntArray1670[j7] = i8;
    		}
    								}
    
    								try {
    									method483(flag, flag1, i2);
    									return;
    								} catch (Exception _ex) {
    									return;
    								}
    	}
    
    	private final void method483(boolean flag, boolean flag1, int i) {
    		for (int j = 0; j < anInt1652; j++) {
    			anIntArray1671[j] = 0;
    		}
    
    		for (int k = 0; k < anInt1630; k++) {
    			if (anIntArray1637 == null || anIntArray1637[k] != -1) {
    				int l = anIntArray1631[k];
    				int k1 = anIntArray1632[k];
    				int j2 = anIntArray1633[k];
    				int i3 = anIntArray1665[l];
    				int l3 = anIntArray1665[k1];
    				int k4 = anIntArray1665[j2];
    				if (flag && (i3 == -5000 || l3 == -5000 || k4 == -5000)) {
    					aBooleanArray1664[k] = true;
    					int j5 = (anIntArray1667[l] + anIntArray1667[k1] + anIntArray1667[j2]) / 3 + anInt1653;
    					anIntArrayArray1672[j5][anIntArray1671[j5]++] = k;
    				} else {
    					if (flag1 && method486(anInt1685, anInt1686, anIntArray1666[l], anIntArray1666[k1], anIntArray1666[j2], i3, l3, k4)) {
    						anIntArray1688[anInt1687++] = i;
    						flag1 = false;
    					}
    					if ((i3 - l3) * (anIntArray1666[j2] - anIntArray1666[k1]) - (anIntArray1666[l] - anIntArray1666[k1]) * (k4 - l3) > 0) {
    						aBooleanArray1664[k] = false;
    						if (i3 < 0 || l3 < 0 || k4 < 0 || i3 > DrawingArea.centerX || l3 > DrawingArea.centerX || k4 > DrawingArea.centerX) {
    							aBooleanArray1663[k] = true;
    						} else {
    							aBooleanArray1663[k] = false;
    						}
    						int k5 = (anIntArray1667[l] + anIntArray1667[k1] + anIntArray1667[j2]) / 3 + anInt1653;
    						anIntArrayArray1672[k5][anIntArray1671[k5]++] = k;
    					}
    				}
    			}
    		}
    
    		if (anIntArray1638 == null) {
    			for (int i1 = anInt1652 - 1; i1 >= 0; i1--) {
    				int l1 = anIntArray1671[i1];
    				if (l1 > 0) {
    					int ai[] = anIntArrayArray1672[i1];
    					for (int j3 = 0; j3 < l1; j3++) {
    						method484(ai[j3]);
    					}
    
    				}
    			}
    
    			return;
    		}
    		for (int j1 = 0; j1 < 12; j1++) {
    			anIntArray1673[j1] = 0;
    			anIntArray1677[j1] = 0;
    		}
    
    		for (int i2 = anInt1652 - 1; i2 >= 0; i2--) {
    			int k2 = anIntArray1671[i2];
    			if (k2 > 0) {
    				int ai1[] = anIntArrayArray1672[i2];
    				for (int i4 = 0; i4 < k2; i4++) {
    					int l4 = ai1[i4];
    					int l5 = anIntArray1638[l4];
    					int j6 = anIntArray1673[l5]++;
    					anIntArrayArray1674[l5][j6] = l4;
    					if (l5 < 10) {
    						anIntArray1677[l5] += i2;
    					} else if (l5 == 10) {
    						anIntArray1675[j6] = i2;
    					} else {
    						anIntArray1676[j6] = i2;
    					}
    				}
    
    			}
    		}
    
    		int l2 = 0;
    		if (anIntArray1673[1] > 0 || anIntArray1673[2] > 0) {
    			l2 = (anIntArray1677[1] + anIntArray1677[2]) / (anIntArray1673[1] + anIntArray1673[2]);
    		}
    		int k3 = 0;
    		if (anIntArray1673[3] > 0 || anIntArray1673[4] > 0) {
    			k3 = (anIntArray1677[3] + anIntArray1677[4]) / (anIntArray1673[3] + anIntArray1673[4]);
    		}
    		int j4 = 0;
    		if (anIntArray1673[6] > 0 || anIntArray1673[8] > 0) {
    			j4 = (anIntArray1677[6] + anIntArray1677[8]) / (anIntArray1673[6] + anIntArray1673[8]);
    		}
    		int i6 = 0;
    		int k6 = anIntArray1673[10];
    		int ai2[] = anIntArrayArray1674[10];
    		int ai3[] = anIntArray1675;
    		if (i6 == k6) {
    			i6 = 0;
    			k6 = anIntArray1673[11];
    			ai2 = anIntArrayArray1674[11];
    			ai3 = anIntArray1676;
    		}
    		int i5;
    		if (i6 < k6) {
    			i5 = ai3[i6];
    		} else {
    			i5 = -1000;
    		}
    		for (int l6 = 0; l6 < 10; l6++) {
    			while (l6 == 0 && i5 > l2) {
    				method484(ai2[i6++]);
    				if (i6 == k6 && ai2 != anIntArrayArray1674[11]) {
    					i6 = 0;
    					k6 = anIntArray1673[11];
    					ai2 = anIntArrayArray1674[11];
    					ai3 = anIntArray1676;
    				}
    				if (i6 < k6) {
    					i5 = ai3[i6];
    				} else {
    					i5 = -1000;
    				}
    			}
    			while (l6 == 3 && i5 > k3) {
    				method484(ai2[i6++]);
    				if (i6 == k6 && ai2 != anIntArrayArray1674[11]) {
    					i6 = 0;
    					k6 = anIntArray1673[11];
    					ai2 = anIntArrayArray1674[11];
    					ai3 = anIntArray1676;
    				}
    				if (i6 < k6) {
    					i5 = ai3[i6];
    				} else {
    					i5 = -1000;
    				}
    			}
    			while (l6 == 5 && i5 > j4) {
    				method484(ai2[i6++]);
    				if (i6 == k6 && ai2 != anIntArrayArray1674[11]) {
    					i6 = 0;
    					k6 = anIntArray1673[11];
    					ai2 = anIntArrayArray1674[11];
    					ai3 = anIntArray1676;
    				}
    				if (i6 < k6) {
    					i5 = ai3[i6];
    				} else {
    					i5 = -1000;
    				}
    			}
    			int i7 = anIntArray1673[l6];
    			int ai4[] = anIntArrayArray1674[l6];
    			for (int j7 = 0; j7 < i7; j7++) {
    				method484(ai4[j7]);
    			}
    
    		}
    
    		while (i5 != -1000) {
    			method484(ai2[i6++]);
    			if (i6 == k6 && ai2 != anIntArrayArray1674[11]) {
    				i6 = 0;
    				ai2 = anIntArrayArray1674[11];
    				k6 = anIntArray1673[11];
    				ai3 = anIntArray1676;
    			}
    			if (i6 < k6) {
    				i5 = ai3[i6];
    			} else {
    				i5 = -1000;
    			}
    		}
    	}
    
    	private final void method484(int i) {
    		if (aBooleanArray1664[i]) {
    			method485(i);
    			return;
    		}
    		int j = anIntArray1631[i];
    		int k = anIntArray1632[i];
    		int l = anIntArray1633[i];
    		Texture.aBoolean1462 = aBooleanArray1663[i];
    		if (anIntArray1639 == null) {
    			Texture.anInt1465 = 0;
    		} else {
    			Texture.anInt1465 = anIntArray1639[i];
    		}
    		int i1;
    		if (anIntArray1637 == null) {
    			i1 = 0;
    		} else {
    			i1 = anIntArray1637[i] & 3;
    		}
    		if (i1 == 0) {
    			Texture.method374(anIntArray1666[j], anIntArray1666[k], anIntArray1666[l], anIntArray1665[j], anIntArray1665[k], anIntArray1665[l], anIntArray1634[i], anIntArray1635[i], anIntArray1636[i]);
    			return;
    		}
    		if (i1 == 1) {
    			Texture.method376(anIntArray1666[j], anIntArray1666[k], anIntArray1666[l], anIntArray1665[j], anIntArray1665[k], anIntArray1665[l], modelIntArray3[anIntArray1634[i]]);
    			return;
    		}
    		if (i1 == 2) {
    			int j1 = anIntArray1637[i] >> 2;
    			int l1 = anIntArray1643[j1];
    			int j2 = anIntArray1644[j1];
    			int l2 = anIntArray1645[j1];
    			Texture.method378(anIntArray1666[j], anIntArray1666[k], anIntArray1666[l], anIntArray1665[j], anIntArray1665[k], anIntArray1665[l], anIntArray1634[i], anIntArray1635[i], anIntArray1636[i], anIntArray1668[l1], anIntArray1668[j2], anIntArray1668[l2], anIntArray1669[l1], anIntArray1669[j2], anIntArray1669[l2], anIntArray1670[l1], anIntArray1670[j2], anIntArray1670[l2], anIntArray1640[i]);
    			return;
    		}
    		if (i1 == 3) {
    			int k1 = anIntArray1637[i] >> 2;
    				int i2 = anIntArray1643[k1];
    				int k2 = anIntArray1644[k1];
    				int i3 = anIntArray1645[k1];
    				Texture.method378(anIntArray1666[j], anIntArray1666[k], anIntArray1666[l], anIntArray1665[j], anIntArray1665[k], anIntArray1665[l], anIntArray1634[i], anIntArray1634[i], anIntArray1634[i], anIntArray1668[i2], anIntArray1668[k2], anIntArray1668[i3], anIntArray1669[i2], anIntArray1669[k2], anIntArray1669[i3], anIntArray1670[i2], anIntArray1670[k2], anIntArray1670[i3], anIntArray1640[i]);
    		}
    	}
    
    	private final void method485(int i) {
    		if (anIntArray1640 != null) {
    			if (anIntArray1640[i] == 65535) {
    				return;
    			}
    		}
    		int j = Texture.textureInt1;
    		int k = Texture.textureInt2;
    		int l = 0;
    		int i1 = anIntArray1631[i];
    		int j1 = anIntArray1632[i];
    		int k1 = anIntArray1633[i];
    		int l1 = anIntArray1670[i1];
    		int i2 = anIntArray1670[j1];
    		int j2 = anIntArray1670[k1];
    
    		if (l1 >= 50) {
    			anIntArray1678[l] = anIntArray1665[i1];
    			anIntArray1679[l] = anIntArray1666[i1];
    			anIntArray1680[l++] = anIntArray1634[i];
    		} else {
    			int k2 = anIntArray1668[i1];
    			int k3 = anIntArray1669[i1];
    			int k4 = anIntArray1634[i];
    			if (j2 >= 50) {
    				int k5 = (50 - l1) * modelIntArray4[j2 - l1];
    				anIntArray1678[l] = j + (k2 + ((anIntArray1668[k1] - k2) * k5 >> 16) << Client.viewDistance) / 50;
    				anIntArray1679[l] = k + (k3 + ((anIntArray1669[k1] - k3) * k5 >> 16) << Client.viewDistance) / 50;
    				anIntArray1680[l++] = k4 + ((anIntArray1636[i] - k4) * k5 >> 16);
    			}
    			if (i2 >= 50) {
    				int l5 = (50 - l1) * modelIntArray4[i2 - l1];
    				anIntArray1678[l] = j + (k2 + ((anIntArray1668[j1] - k2) * l5 >> 16) << Client.viewDistance) / 50;
    				anIntArray1679[l] = k + (k3 + ((anIntArray1669[j1] - k3) * l5 >> 16) << Client.viewDistance) / 50;
    				anIntArray1680[l++] = k4 + ((anIntArray1635[i] - k4) * l5 >> 16);
    			}
    		}
    		if (i2 >= 50) {
    			anIntArray1678[l] = anIntArray1665[j1];
    			anIntArray1679[l] = anIntArray1666[j1];
    			anIntArray1680[l++] = anIntArray1635[i];
    		} else {
    			int l2 = anIntArray1668[j1];
    			int l3 = anIntArray1669[j1];
    			int l4 = anIntArray1635[i];
    			if (l1 >= 50) {
    				int i6 = (50 - i2) * modelIntArray4[l1 - i2];
    				anIntArray1678[l] = j + (l2 + ((anIntArray1668[i1] - l2) * i6 >> 16) << Client.viewDistance) / 50;
    				anIntArray1679[l] = k + (l3 + ((anIntArray1669[i1] - l3) * i6 >> 16) << Client.viewDistance) / 50;
    				anIntArray1680[l++] = l4 + ((anIntArray1634[i] - l4) * i6 >> 16);
    			}
    			if (j2 >= 50) {
    				int j6 = (50 - i2) * modelIntArray4[j2 - i2];
    				anIntArray1678[l] = j + (l2 + ((anIntArray1668[k1] - l2) * j6 >> 16) << Client.viewDistance) / 50;
    				anIntArray1679[l] = k + (l3 + ((anIntArray1669[k1] - l3) * j6 >> 16) << Client.viewDistance) / 50;
    				anIntArray1680[l++] = l4 + ((anIntArray1636[i] - l4) * j6 >> 16);
    			}
    		}
    		if (j2 >= 50) {
    			anIntArray1678[l] = anIntArray1665[k1];
    			anIntArray1679[l] = anIntArray1666[k1];
    			anIntArray1680[l++] = anIntArray1636[i];
    		} else {
    			int i3 = anIntArray1668[k1];
    			int i4 = anIntArray1669[k1];
    			int i5 = anIntArray1636[i];
    			if (i2 >= 50) {
    				int k6 = (50 - j2) * modelIntArray4[i2 - j2];
    				anIntArray1678[l] = j + (i3 + ((anIntArray1668[j1] - i3) * k6 >> 16) << Client.viewDistance) / 50;
    				anIntArray1679[l] = k + (i4 + ((anIntArray1669[j1] - i4) * k6 >> 16) << Client.viewDistance) / 50;
    				anIntArray1680[l++] = i5 + ((anIntArray1635[i] - i5) * k6 >> 16);
    			}
    			if (l1 >= 50) {
    				int l6 = (50 - j2) * modelIntArray4[l1 - j2];
    				anIntArray1678[l] = j + (i3 + ((anIntArray1668[i1] - i3) * l6 >> 16) << Client.viewDistance) / 50;
    				anIntArray1679[l] = k + (i4 + ((anIntArray1669[i1] - i4) * l6 >> 16) << Client.viewDistance) / 50;
    				anIntArray1680[l++] = i5 + ((anIntArray1634[i] - i5) * l6 >> 16);
    			}
    		}
    		int j3 = anIntArray1678[0];
    		int j4 = anIntArray1678[1];
    		int j5 = anIntArray1678[2];
    		int i7 = anIntArray1679[0];
    		int j7 = anIntArray1679[1];
    		int k7 = anIntArray1679[2];
    		if ((j3 - j4) * (k7 - j7) - (i7 - j7) * (j5 - j4) > 0) {
    			Texture.aBoolean1462 = false;
    			if (l == 3) {
    				if (j3 < 0 || j4 < 0 || j5 < 0 || j3 > DrawingArea.centerX || j4 > DrawingArea.centerX || j5 > DrawingArea.centerX) {
    					Texture.aBoolean1462 = true;
    				}
    				int l7;
    				if (anIntArray1637 == null) {
    					l7 = 0;
    				} else {
    					l7 = anIntArray1637[i] & 3;
    				}
    				if (l7 == 0) {
    					Texture.method374(i7, j7, k7, j3, j4, j5, anIntArray1680[0], anIntArray1680[1], anIntArray1680[2]);
    				} else if (l7 == 1) {
    					Texture.method376(i7, j7, k7, j3, j4, j5, modelIntArray3[anIntArray1634[i]]);
    				} else if (l7 == 2) {
    					int j8 = anIntArray1637[i] >> 2;
    					int k9 = anIntArray1643[j8];
    					int k10 = anIntArray1644[j8];
    					int k11 = anIntArray1645[j8];
    					Texture.method378(i7, j7, k7, j3, j4, j5, anIntArray1680[0], anIntArray1680[1], anIntArray1680[2], anIntArray1668[k9], anIntArray1668[k10], anIntArray1668[k11], anIntArray1669[k9], anIntArray1669[k10], anIntArray1669[k11], anIntArray1670[k9], anIntArray1670[k10], anIntArray1670[k11], anIntArray1640[i]);
    				} else if (l7 == 3) {
    					int k8 = anIntArray1637[i] >> 2;
    					int l9 = anIntArray1643[k8];
    					int l10 = anIntArray1644[k8];
    					int l11 = anIntArray1645[k8];
    					Texture.method378(i7, j7, k7, j3, j4, j5, anIntArray1634[i], anIntArray1634[i], anIntArray1634[i], anIntArray1668[l9], anIntArray1668[l10], anIntArray1668[l11], anIntArray1669[l9], anIntArray1669[l10], anIntArray1669[l11], anIntArray1670[l9], anIntArray1670[l10], anIntArray1670[l11], anIntArray1640[i]);
    				}
    			}
    			if (l == 4) {
    				if (j3 < 0 || j4 < 0 || j5 < 0 || j3 > DrawingArea.centerX || j4 > DrawingArea.centerX || j5 > DrawingArea.centerX || anIntArray1678[3] < 0 || anIntArray1678[3] > DrawingArea.centerX) {
    					Texture.aBoolean1462 = true;
    				}
    				int i8;
    				if (anIntArray1637 == null) {
    					i8 = 0;
    				} else {
    					i8 = anIntArray1637[i] & 3;
    				}
    				if (i8 == 0) {
    					Texture.method374(i7, j7, k7, j3, j4, j5, anIntArray1680[0], anIntArray1680[1], anIntArray1680[2]);
    					Texture.method374(i7, k7, anIntArray1679[3], j3, j5, anIntArray1678[3], anIntArray1680[0], anIntArray1680[2], anIntArray1680[3]);
    					return;
    				}
    				if (i8 == 1) {
    					int l8 = modelIntArray3[anIntArray1634[i]];
    					Texture.method376(i7, j7, k7, j3, j4, j5, l8);
    					Texture.method376(i7, k7, anIntArray1679[3], j3, j5, anIntArray1678[3], l8);
    					return;
    				}
    				if (i8 == 2) {
    					int i9 = anIntArray1637[i] >> 2;
    					int i10 = anIntArray1643[i9];
    					int i11 = anIntArray1644[i9];
    					int i12 = anIntArray1645[i9];
    					Texture.method378(i7, j7, k7, j3, j4, j5, anIntArray1680[0], anIntArray1680[1], anIntArray1680[2], anIntArray1668[i10], anIntArray1668[i11], anIntArray1668[i12], anIntArray1669[i10], anIntArray1669[i11], anIntArray1669[i12], anIntArray1670[i10], anIntArray1670[i11], anIntArray1670[i12], anIntArray1640[i]);
    					Texture.method378(i7, k7, anIntArray1679[3], j3, j5, anIntArray1678[3], anIntArray1680[0], anIntArray1680[2], anIntArray1680[3], anIntArray1668[i10], anIntArray1668[i11], anIntArray1668[i12], anIntArray1669[i10], anIntArray1669[i11], anIntArray1669[i12], anIntArray1670[i10], anIntArray1670[i11], anIntArray1670[i12], anIntArray1640[i]);
    					return;
    				}
    				if (i8 == 3) {
    					int j9 = anIntArray1637[i] >> 2;
    					int j10 = anIntArray1643[j9];
    					int j11 = anIntArray1644[j9];
    					int j12 = anIntArray1645[j9];
    					Texture.method378(i7, j7, k7, j3, j4, j5, anIntArray1634[i], anIntArray1634[i], anIntArray1634[i], anIntArray1668[j10], anIntArray1668[j11], anIntArray1668[j12], anIntArray1669[j10], anIntArray1669[j11], anIntArray1669[j12], anIntArray1670[j10], anIntArray1670[j11], anIntArray1670[j12], anIntArray1640[i]);
    					Texture.method378(i7, k7, anIntArray1679[3], j3, j5, anIntArray1678[3], anIntArray1634[i], anIntArray1634[i], anIntArray1634[i], anIntArray1668[j10], anIntArray1668[j11], anIntArray1668[j12], anIntArray1669[j10], anIntArray1669[j11], anIntArray1669[j12], anIntArray1670[j10], anIntArray1670[j11], anIntArray1670[j12], anIntArray1640[i]);
    				}
    			}
    		}
    	}
    
    	private final boolean method486(int i, int j, int k, int l, int i1, int j1, int k1, int l1) {
    		if (j < k && j < l && j < i1) {
    			return false;
    		}
    		if (j > k && j > l && j > i1) {
    			return false;
    		}
    		if (i < j1 && i < k1 && i < l1) {
    			return false;
    		}
    		return i <= j1 || i <= k1 || i <= l1;
    	}
    	
    	public void setTexture(int fromColor, int tex) {
    		//printModelColours(this);
    		int foundAmt = 0;
    		int set2 = 0;
    		for (int i = 0; i < anIntArray1640.length; i++)
    			if (fromColor == anIntArray1640[i])
    				foundAmt++;
    		anInt1642 = foundAmt;
    		if (anIntArray1637 == null)
    			anIntArray1637 = new int[foundAmt];
    		if (anIntArray1640 == null)
    			anIntArray1640 = new int[foundAmt];
    		anIntArray1643 = new int[foundAmt];
    		anIntArray1644 = new int[foundAmt];
    		anIntArray1645 = new int[foundAmt];
    		int assigned = 0;
    		for (int i = 0; i < anInt1630; i++) {
    			if (fromColor == anIntArray1640[i]) {
    				anIntArray1640[i] = tex;
    				anIntArray1637[i] = 3 + set2;
    				set2 += 4;
    				anIntArray1643[assigned] = anIntArray1631[i];
    				anIntArray1644[assigned] = anIntArray1632[i];
    				anIntArray1645[assigned] = anIntArray1633[i];
    				assigned++;
    			}
    		}
    	}
    
    	public void setTexture(int tex) {
    		anInt1642 = anInt1630;
    		int set2 = 0;
    		if (anIntArray1637 == null)
    			anIntArray1637 = new int[anInt1630];
    		if (anIntArray1640 == null)
    			anIntArray1640 = new int[anInt1630];
    		anIntArray1643 = new int[anInt1630];
    		anIntArray1644 = new int[anInt1630];
    		anIntArray1645 = new int[anInt1630];
    
    		for (int i = 0; i < anInt1630; i++) {
    			anIntArray1640[i] = tex;
    			anIntArray1637[i] = 3 + set2;
    			set2 += 4;
    			anIntArray1643[i] = anIntArray1631[i];
    			anIntArray1644[i] = anIntArray1632[i];
    			anIntArray1645[i] = anIntArray1633[i];
    		}
    	}
    	public static void printModelColours(Model model) {
    		ArrayList<Integer> list = new ArrayList<Integer>();
    		for (int i : model.anIntArray1640) {
    			list.add(i);
    		}
    		ArrayList<Integer> done = new ArrayList<Integer>();
    		for (Integer i : list) {
    			if (done.contains(i))
    				continue;
    			int amt = 0;
    			for (Integer j : list) {
    				if (j.intValue() == i.intValue())
    					amt++;
    			}
    			System.out.println(i + " on " + amt + " faces");
    			done.add(i);
    		}
    	}
    
    	private boolean aBoolean1618;
    	public static int anInt1620;
    	public static Model aModel_1621 = new Model(true);
    	private static int anIntArray1622[] = new int[2000];
    	private static int anIntArray1623[] = new int[2000];
    	private static int anIntArray1624[] = new int[2000];
    	private static int anIntArray1625[] = new int[2000];
    	public int anInt1626;
    	public int anIntArray1627[];
    	public int anIntArray1628[];
    	public int anIntArray1629[];
    	public int anInt1630;
    	public int anIntArray1631[];
    	public int anIntArray1632[];
    	public int anIntArray1633[];
    	public int anIntArray1634[];
    	public int anIntArray1635[];
    	public int anIntArray1636[];
    	public int anIntArray1637[];
    	public int anIntArray1638[];
    	public int anIntArray1639[];
    	public int anIntArray1640[];
    	public int anInt1641;
    	public int anInt1642;
    	public int anIntArray1643[];
    	public int anIntArray1644[];
    	public int anIntArray1645[];
    	public int anInt1646;
    	public int anInt1647;
    	public int anInt1648;
    	public int anInt1649;
    	public int anInt1650;
    	public int anInt1651;
    	public int anInt1652;
    	public int anInt1653;
    	public int anInt1654;
    	public int anIntArray1655[];
    	public int anIntArray1656[];
    	public int anIntArrayArray1657[][];
    	public int anIntArrayArray1658[][];
    	public boolean aBoolean1659;
    	Class33 aClass33Array1660[];
    	static Class21 aClass21Array1661[];
    	static OnDemandFetcherParent aOnDemandFetcherParent_1662;
    	static boolean aBooleanArray1663[] = new boolean[15000];
    	static boolean aBooleanArray1664[] = new boolean[15000];
    	static int anIntArray1665[] = new int[15000];
    	static int anIntArray1666[] = new int[15000];
    	static int anIntArray1667[] = new int[15000];
    	static int anIntArray1668[] = new int[15000];
    	static int anIntArray1669[] = new int[15000];
    	static int anIntArray1670[] = new int[15000];
    	static int anIntArray1671[] = new int[15000];
    	static int anIntArrayArray1672[][] = new int[15000][512];
    	static int anIntArray1673[] = new int[12];
    	static int anIntArrayArray1674[][] = new int[12][15000];
    	static int anIntArray1675[] = new int[15000];
    	static int anIntArray1676[] = new int[15000];
    	static int anIntArray1677[] = new int[12];
    	static int anIntArray1678[] = new int[10];
    	static int anIntArray1679[] = new int[10];
    	static int anIntArray1680[] = new int[10];
    	static int anInt1681;
    	static int anInt1682;
    	static int anInt1683;
    	public static boolean aBoolean1684;
    	public static int anInt1685;
    	public static int anInt1686;
    	public static int anInt1687;
    	public static int anIntArray1688[] = new int[15000];
    	public static int modelIntArray1[];
    	public static int modelIntArray2[];
    	static int modelIntArray3[];
    	static int modelIntArray4[];
    
    	static {
    		modelIntArray1 = Texture.anIntArray1470;
    		modelIntArray2 = Texture.anIntArray1471;
    		modelIntArray3 = Texture.anIntArray1482;
    		modelIntArray4 = Texture.anIntArray1469;
    	}
    }
    this is my model.java if it helps



    and this is my itemdef.java

    Code:
    package com.client.definitions;
    
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.URL;
    import java.net.URLConnection;
    
    import com.client.Configuration;
    import com.client.DrawingArea;
    import com.client.FileOperations;
    import com.client.MRUNodes;
    import com.client.Model;
    import com.client.Sprite;
    import com.client.Stream;
    import com.client.StreamLoader;
    import com.client.Texture;
    import com.client.sign.Signlink;
    
    
    public final class ItemDefinition {
    
    	public static void unpackConfig(final StreamLoader streamLoader) {
    		//stream = new Stream(streamLoader.getDataForName("obj.dat"));
    		//Stream stream = new Stream(streamLoader.getDataForName("obj.idx"));
    		stream = new Stream(FileOperations.readFile(Signlink.findCacheDir() + "/data/obj.dat"));
    		final Stream stream = new Stream(FileOperations.readFile(Signlink.findCacheDir() + "/data/obj.idx"));
    	
    		totalItems = stream.readUnsignedWord();
    		streamIndices = new int[totalItems + 1000];
    		int i = 2;
    		for (int j = 0; j < totalItems; j++) {
    			streamIndices[j] = i;
    			i += stream.readUnsignedWord();
    		}
    
    		cache = new ItemDefinition[10];
    		for (int index = 0; index < 10; index++) {
    			cache[index] = new ItemDefinition();
    		}
    		System.out.println("Loaded a total amount of: " + totalItems + " items.");
    	}
    
    	public static ItemDefinition forID(int itemId) {
    		for (int j = 0; j < 10; j++) {
    			if (cache[j].id == itemId) {
    				return cache[j];
    			}
    		}
    		
    		if (itemId == -1)
    			itemId = 0;
    		if (itemId > streamIndices.length)
    			itemId = 0;
    		
    		cacheIndex = (cacheIndex + 1) % 10;
    		final ItemDefinition itemDef = cache[cacheIndex];
    		stream.currentOffset = streamIndices[itemId];
    		itemDef.id = itemId;
    		itemDef.setDefaults();
    		itemDef.readValues(stream);
    
    		if (itemDef.certTemplateID != -1) {
    			itemDef.toNote();
    		}
    
    		if (itemDef.opcode140 != -1) {
    			itemDef.method2789(forID(itemDef.opcode140), forID(itemDef.opcode139));
    		}
    
    		if (itemDef.opcode149 != -1) {
    			itemDef.method2790(forID(itemDef.opcode149), forID(itemDef.opcode148));
    		}
    		
    		customItems(itemDef.id);
    
    		switch (itemId) {
    
    		}
    
    		return itemDef;
    	}
    	public static void applyTexturing(Model model, int id) {
    		switch (id) {
    				case 21285:
    					model.setTexture(127, 49);
    					break;
    				case 21295:
    					model.setTexture(127, 49);
    					break;
    		}
    	}
    	private static void customItems(int itemId) {
    		ItemDefinition itemDef = forID(itemId);
    	
    		switch (itemId) {
    		
    		case 21285:
    			itemDef.originalModelColors= new int[1];
    			itemDef.modifiedModelColors = new int[1];
    			itemDef.originalModelColors[0] = 49;
    			itemDef.modifiedModelColors[0] = 127;
    			break;
    		case 21295:
    		itemDef.originalModelColors= new int[1];
    		itemDef.modifiedModelColors = new int[1];
    		itemDef.originalModelColors[0] = 49;
    		itemDef.modifiedModelColors[0] = 127;
    		break;
    		
    		case 11864:
    		case 11865:
    		case 19639:
    		case 19641:
    		case 19643:
    		case 19645:
    		case 19647:
    		case 19649:
    			itemDef.equipActions[2] = "Log";
    			itemDef.equipActions[1] = "Check";
    			itemDef.equipActions[0] = "Remove";
    			break;
    			
    		case 13136:
    			itemDef.equipActions[2] = "Elidinis";
    			itemDef.equipActions[1] = "Kalphite Hive";
    			itemDef.equipActions[0] = "Remove";
    			break;
    		
    		case 1712:
    		case 1710:
    		case 1708:
    		case 1706:
    			itemDef.equipActions[2] = "Draynor";
    			itemDef.equipActions[1] = "Al-Kharid";
    			itemDef.equipActions[0] = "Remove";
    			break;
    				
    	    case 2552:
    		case 2554:
    		case 2556:
    		case 2558:
    		case 2560:
    		case 2562:
    		case 2564:
    		case 2566: //Ring of duelling
    			itemDef.equipActions[2] = "Shantay Pass";
    			itemDef.equipActions[1] = "Clan wars";
    			itemDef.equipActions[0] = "Remove";
    			break;
    
    		case 11773:
    		case 11771:
    		case 11770:
    		case 11772:
    			itemDef.anInt196 += 45;
    			break;
    		case 405:
    			itemDef.name = "PvM Casket";
    			break;
    		case 21034:
    			itemDef.name = "Prayer Scroll";
    			break;
    		case 21307:
    			itemDef.name = "Pursuit Crate";
    			break;
    		case 7310:
    			itemDef.name = "Skill Casket";
    			break;
    		case 2678:
    			itemDef.name = "Scroll of Defence";
    			itemDef.description = "Read this scroll to reset your defence level.";
    			break;
    		case 19841:
    			itemDef.name = "Casket (master)";
    			itemDef.description = "A casket only obtainable by masters.";
    			break;
    		case 2697:
    			itemDef.name = "$10 Scroll";
    			itemDef.description = "Read this scroll to be rewarded with the Donator status.";
    			break;
    		case 2698:
    			itemDef.name = "$50 Scroll";
    			itemDef.description = "Read this scroll to be rewarded with the Super Donator status.";
    			break;
    		case 2699:
    			itemDef.name = "$150 Donator";
    			itemDef.description = "Read this scroll to be rewarded with the Extreme Donator status.";
    			break;
    		case 2700:
    			itemDef.name = "$300 Scroll";
    			itemDef.description = "Read this scroll to be rewarded with the Legendary Donator status.";
    			break;
    		case 2701:
    			itemDef.name = "Gambler Scroll";
    			itemDef.description = "Read this scroll to be rewarded with the Gambler rank.";
    			break;
    		case 1464:
    			itemDef.name = "Vote Ticket";
    			itemDef.description = "This ticket can be exchanged for a voting point.";
    			break;
    		case 2996:
    			itemDef.name = "PK Point Ticket";
    			itemDef.description = "Exchange this for a PK Point.";
    			break;
    		case 8901:
    			itemDef.inventoryOptions = new String[5];
    			itemDef.inventoryOptions[1] = "Wear";
    			itemDef.inventoryOptions[2] = "Assemble";
    			break;
    		case 19675:
    			itemDef.inventoryOptions = new String[5];
    			itemDef.inventoryOptions[1] = "Wield";
    			itemDef.inventoryOptions[2] = "Remove Charges";
    			break;
    		case 21347:
    			itemDef.inventoryOptions = new String[5];
    			itemDef.inventoryOptions[1] = "Set Bolt Tips";
    			itemDef.inventoryOptions[2] = "Set Arrowtips";
    			itemDef.inventoryOptions[3] = "Set Javelin Heads";
    			break;
    		case 2839:
    			itemDef.name = "Slayer Helmet Recipe";
    			itemDef.description = "Read this scroll to learn the slayer helmet recipe.";
    			break;
    			
    		case 13656:
    			itemDef.name = "Combat Box";
    			itemDef.inventoryOptions = new String[] { null, "Open", null, null, "Drop" };
    			break;
    			
    		case 11918:
    			itemDef.name = "Supply Box";
    			itemDef.inventoryOptions = new String[] { null, "Open", null, null, "Drop" };
    			break;
    			
    		case 20703:
    			itemDef.name = "Daily Gear Box";
    			break;
    			
    		case 20791:
    			itemDef.name = "Daily Skill Box";
    			break;
    			
    		case 12792:
    			itemDef.inventoryOptions = new String[] { null, null, null, null, "Drop" };
    			itemDef.modelId = 8956;
    			itemDef.modelZoom = 842;
    			itemDef.stackable = false;
    			itemDef.name = "Graceful Recolour";
    			itemDef.description = "A mix to use on a set of graceful.";
    			break;
    
    		case 15098:
    			itemDef.name = "Dice (up to 100)";
    			itemDef.description = "A 100-sided dice.";
    			itemDef.modelId = 31223;
    			itemDef.modelZoom = 1104;
    			itemDef.modelRotation2 = 215;
    			itemDef.modelRotation1 = 94;
    			itemDef.modelOffset2 = -5;
    			itemDef.modelOffset1 = -18;
    			itemDef.inventoryOptions = new String[5];
    			itemDef.inventoryOptions[1] = "Public-roll";
    			itemDef.inventoryOptions[2] = null;
    			itemDef.name = "Dice (up to 100)";
    			itemDef.anInt196 = 15;
    			itemDef.anInt184 = 25;
    			break;
    		case 14484:
    			itemDef.inventoryOptions = new String[5];
    			itemDef.inventoryOptions[1] = "Wield";
    			itemDef.modelId = 44590;
    			itemDef.maleModel = 43660;// anInt165
    			itemDef.femaleModel = 43660;// anInt200
    			itemDef.modelZoom = 789;
    			itemDef.modelRotation1 = 240;
    			itemDef.modelRotation2 = 60;
    			itemDef.modelOffset1 = -1;
    			itemDef.modelOffset2 = -23;
    			itemDef.name = "Dragon claws";
    			itemDef.description = "A set of fighting claws.";
    			break;
    		case 12840:
    			itemDef.name = "Death Jr";
    			itemDef.inventoryOptions = new String[] { null, null, null, null, "Drop" };
    			break;
    		case 9958:
    			itemDef.name = "Santa Jr";
    			itemDef.modelId = 28976;
    			itemDef.modelRotation1 = 512;
    			itemDef.modelRotation2 = 0;
    			itemDef.modelZoom = 725;
    			itemDef.modelOffset1 = 1;
    			itemDef.modelOffset2 = 1;
    			itemDef.inventoryOptions = new String[] { null, null, null, null, "Drop" };
    			break;
    		case 9959:
    			itemDef.name = "Anti-Santa Jr";
    			itemDef.modelId = 28975;
    			itemDef.modelRotation1 = 512;
    			itemDef.modelRotation2 = 0;
    			itemDef.modelZoom = 725;
    			itemDef.modelOffset1 = 0;
    			itemDef.modelOffset2 = 0;
    			itemDef.inventoryOptions = new String[] { null, null, null, null, "Drop" };
    			break;
    		case 11739:
    			itemDef.name = "Hourly Reward";
    			itemDef.inventoryOptions = new String[] { "Open", null, null, null, "Drop" };
    			break;
    		case 8021:
    			itemDef.name = "Hosidius House Teleport";
    			break;
    		case 8020:
    			itemDef.name = "Lovakengj House Teleport";
    			break;
    		case 8019:
    			itemDef.name = "Piscarilius House Teleport";
    			break;
    		case 8018:
    			itemDef.name = "Shayzien House Teleport";
    			break;
    		case 8017:
    			itemDef.name = "Mt Quidamortem Teleport";
    			break;
    		case 12409:
    			itemDef.name = "Resource Area Teleport";
    			itemDef.description = "Teleports you directly to the Resource Area gate (deep wilderness).";
    			break;
    		case 12410:
    			itemDef.name = "Mage Bank Teleport";
    			itemDef.description = "Teleports you directly into Mage Bank.";
    			break;
    		case 12408:
    			itemDef.name = "Callisto Teleport";
    			itemDef.description = "Teleports you directly to Callisto.";
    			break;
    		case 12411:
    			itemDef.name = "KBD Lair Teleport";
    			itemDef.description = "Teleports you directly into KBD's lair.";
    			break;
    		case 12407:
    			itemDef.name = "Pirate's Hut Teleport";
    			itemDef.description = "Teleports you directly to the Pirate's Hut (deep wild).";
    			break;
    		}
    	}
    	
    	void method2789(ItemDefinition var1, ItemDefinition var2) {
    		modelId = var1.modelId * 1;
    		modelZoom = var1.modelZoom * 1;
    		modelRotation1 = 1 * var1.modelRotation1;
    		modelRotation2 = 1 * var1.modelRotation2;
    		anInt204 = 1 * var1.anInt204;
    		modelOffset1 = 1 * var1.modelOffset1;
    		modelOffset2 = var1.modelOffset2 * 1;
    		originalModelColors = var2.originalModelColors;
    		modifiedModelColors = var2.modifiedModelColors;
    		originalTextureColors = var2.originalTextureColors;
    		modifiedTextureColors = var2.modifiedTextureColors;
    		name = var2.name;
    		membersObject = var2.membersObject;
    		stackable = var2.stackable;
    		maleModel = 1 * var2.maleModel;
    		anInt188 = 1 * var2.anInt188;
    		anInt185 = 1 * var2.anInt185;
    		femaleModel = var2.femaleModel * 1;
    		anInt164 = var2.anInt164 * 1;
    		anInt162 = 1 * var2.anInt162;
    		anInt175 = 1 * var2.anInt175;
    		anInt166 = var2.anInt166 * 1;
    		anInt197 = var2.anInt197 * 1;
    		anInt173 = var2.anInt173 * 1;
    		team = var2.team * 1;
    		groundOptions = var2.groundOptions;
    		inventoryOptions = new String[5];
    		equipActions = new String[5];
    		if (null != var2.inventoryOptions) {
    			for (int var4 = 0; var4 < 4; ++var4) {
    				inventoryOptions[var4] = var2.inventoryOptions[var4];
    			}
    		}
    
    		inventoryOptions[4] = "Discard";
    		value = 0;
    	}
    	
    	void method2790(ItemDefinition var1, ItemDefinition var2) {
    		modelId = var1.modelId * 1;
    		modelZoom = 1 * var1.modelZoom;
    		modelRotation1 = var1.modelRotation1 * 1;
    		modelRotation2 = var1.modelRotation2 * 1;
    		anInt204 = var1.anInt204 * 1;
    		modelOffset1 = 1 * var1.modelOffset1;
    		modelOffset2 = var1.modelOffset2 * 1;
    		originalModelColors = var1.originalModelColors;
    		modifiedModelColors = var1.modifiedModelColors;
    		originalTextureColors = var1.originalTextureColors;
    		modifiedTextureColors = var1.modifiedTextureColors;
    		stackable = var1.stackable;
    		name = var2.name;
    		value = 0;
    	}
    	
    /*	private void readValues(Stream stream) {
    		while(true) {
    			int opcode = stream.readUnsignedByte();
    			if(opcode == 0)
    				return;
    			if(opcode == 1)
    				modelId = stream.readUnsignedWord();
    			else if(opcode == 2)
    				name = stream.readString();
    			else if(opcode == 3)
    				description = stream.readString();
    			else if(opcode == 4)
    				modelZoom = stream.readUnsignedWord();
    			else if(opcode == 5)
    				modelRotation1 = stream.readUnsignedWord();
    			else if(opcode == 6)
    				modelRotation2 = stream.readUnsignedWord();
    			else if(opcode == 7) {
    				modelOffset1 = stream.readUnsignedWord();
    				if(modelOffset1 > 32767)
    					modelOffset1 -= 0x10000;
    			} else if(opcode == 8) {
    				modelOffset2 = stream.readUnsignedWord();
    				if(modelOffset2 > 32767)
    					modelOffset2 -= 0x10000;
    			} else if(opcode == 11)
    				stackable = true;
    			else if(opcode == 12)
    				value = stream.readDWord();
    			else if(opcode == 16)
    				membersObject = true;
    			else if(opcode == 23) {
    				maleModel = stream.readUnsignedWord();
    				aByte205 = stream.readSignedByte();
    			} else if (opcode == 24)
    				anInt188 = stream.readUnsignedWord();
    			else if (opcode == 25) {
    				femaleModel = stream.readUnsignedWord();
    				aByte154 = stream.readSignedByte();
    			} else if (opcode == 26)
    				anInt164 = stream.readUnsignedWord();
    			else if(opcode >= 30 && opcode < 35) {
    				if(groundOptions == null)
    					groundOptions = new String[5];
    				groundOptions[opcode - 30] = stream.readString();
    				if(groundOptions[opcode - 30].equalsIgnoreCase("hidden"))
    					groundOptions[opcode - 30] = null;
    			} else if(opcode >= 35 && opcode < 40) {
    				if(inventoryOptions == null)
    					inventoryOptions = new String[5];
    				inventoryOptions[opcode - 35] = stream.readString();
    			} else if(opcode == 40) {
    				int size = stream.readUnsignedByte();
    				originalModelColors = new int[size];
    				modifiedModelColors = new int[size];
    				for(int index = 0; index < size; index++) {
    					originalModelColors[index] = stream.readUnsignedWord();
    					modifiedModelColors[index] = stream.readUnsignedWord();
    				}
    			} else if(opcode == 41) {
    				int size = stream.readUnsignedByte();
    				originalTextureColors = new short[size];
    				modifiedTextureColors = new short[size];
    				for(int index = 0; index < size; index++) {
    					originalTextureColors[index] = (short) stream.readUnsignedWord();
    					modifiedTextureColors[index] = (short) stream.readUnsignedWord();
    				}
    			} else if(opcode == 65) {
    				searchableItem = true;
    			} else if(opcode == 78)
    				anInt185 = stream.readUnsignedWord();
    			else if(opcode == 79)
    				anInt162 = stream.readUnsignedWord();
    			else if(opcode == 90)
    				anInt175 = stream.readUnsignedWord();
    			else if(opcode == 91)
    				anInt197 = stream.readUnsignedWord();
    			else if(opcode == 92)
    				anInt166 = stream.readUnsignedWord();
    			else if(opcode == 93)
    				anInt173 = stream.readUnsignedWord();
    			else if(opcode == 95)
    				anInt204 = stream.readUnsignedWord();
    			else if(opcode == 97)
    				certID = stream.readUnsignedWord();
    			else if(opcode == 98)
    				certTemplateID = stream.readUnsignedWord();
    			else if (opcode >= 100 && opcode < 110) {
    				if (stackIDs == null) {
    					stackIDs = new int[10];
    					stackAmounts = new int[10];
    				}
    				stackIDs[opcode - 100] = stream.readUnsignedWord();
    				stackAmounts[opcode - 100] = stream.readUnsignedWord();
    			} else if(opcode == 110)
    				anInt167 = stream.readUnsignedWord();
    			else if(opcode == 111)
    				anInt192 = stream.readUnsignedWord();
    			else if(opcode == 112)
    				anInt191 = stream.readUnsignedWord();
    			else if(opcode == 113)
    				anInt196 = stream.readSignedByte();
    			else if(opcode == 114)
    				anInt184 = stream.readSignedByte() * 5;
    			else if(opcode == 115)
    				team = stream.readUnsignedByte();
    			else if (opcode == 139)
    				opcode139 = stream.readUnsignedWord();
    			else if (opcode == 140)
    				opcode140 = stream.readUnsignedWord();
    			else if (opcode == 148)
    				opcode148 = stream.readUnsignedWord();
    			else if (opcode == 149)
    				opcode149 = stream.readUnsignedWord();
    			else {
    				System.out.println("Error loading item " + id + ", opcode " + opcode);
    			}
    		}
    	}*/
    	
    	private void readValues(Stream stream) {
    		while (true) {
    			int opcode = stream.readUnsignedByte();
    			if (opcode == 0)
    				return;
    			if (opcode == 1)
    				modelId = stream.readUnsignedWord();
    			else if (opcode == 2)
    				name = stream.readString();
    			else if (opcode == 3)
    				description = stream.readString();
    			else if (opcode == 4)
    				modelZoom = stream.readUnsignedWord();
    			else if (opcode == 5)
    				modelRotation1 = stream.readUnsignedWord();
    			else if (opcode == 6)
    				modelRotation2 = stream.readUnsignedWord();
    			else if (opcode == 7) {
    				modelOffset1 = stream.readUnsignedWord();
    				if (modelOffset1 > 32767)
    					modelOffset1 -= 0x10000;
    			} else if (opcode == 8) {
    				modelOffset2 = stream.readUnsignedWord();
    				if (modelOffset2 > 32767)
    					modelOffset2 -= 0x10000;
    			} else if (opcode == 11)
    				stackable = true;
    			else if (opcode == 12)
    				value = stream.readDWord();
    			else if (opcode == 16)
    				membersObject = true;
    			else if (opcode == 23) {
    				maleModel = stream.readUnsignedWord();
    				aByte205 = stream.readSignedByte();
    			} else if (opcode == 24)
    				anInt188 = stream.readUnsignedWord();
    			else if (opcode == 25) {
    				femaleModel = stream.readUnsignedWord();
    				aByte154 = stream.readSignedByte();
    			} else if (opcode == 26)
    				anInt164 = stream.readUnsignedWord();
    			else if (opcode >= 30 && opcode < 35) {
    				if (groundOptions == null)
    					groundOptions = new String[5];
    				groundOptions[opcode - 30] = stream.readString();
    				if (groundOptions[opcode - 30].equalsIgnoreCase("hidden"))
    					groundOptions[opcode - 30] = null;
    			} else if (opcode >= 35 && opcode < 40) {
    				if (inventoryOptions == null)
    					inventoryOptions = new String[5];
    				inventoryOptions[opcode - 35] = stream.readString();
    			} else if (opcode == 40) {
    				int size = stream.readUnsignedByte();
    				originalModelColors = new int[size];
    				modifiedModelColors = new int[size];
    				for (int index = 0; index < size; index++) {
    					originalModelColors[index] = stream.readUnsignedWord();
    					modifiedModelColors[index] = stream.readUnsignedWord();
    				}
    			} else if (opcode == 41) {
    				int size = stream.readUnsignedByte();
    				originalTextureColors = new short[size];
    				modifiedTextureColors = new short[size];
    				for (int index = 0; index < size; index++) {
    					originalTextureColors[index] = (short) stream.readUnsignedWord();
    					modifiedTextureColors[index] = (short) stream.readUnsignedWord();
    				}
    			} else if (opcode == 65) {
    				searchableItem = true;
    			} else if (opcode == 78)
    				anInt185 = stream.readUnsignedWord();
    			else if (opcode == 79)
    				anInt162 = stream.readUnsignedWord();
    			else if (opcode == 90)
    				anInt175 = stream.readUnsignedWord();
    			else if (opcode == 91)
    				anInt197 = stream.readUnsignedWord();
    			else if (opcode == 92)
    				anInt166 = stream.readUnsignedWord();
    			else if (opcode == 93)
    				anInt173 = stream.readUnsignedWord();
    			else if (opcode == 95)
    				anInt204 = stream.readUnsignedWord();
    			else if (opcode == 97)
    				certID = stream.readUnsignedWord();
    			else if (opcode == 98)
    				certTemplateID = stream.readUnsignedWord();
    			else if (opcode >= 100 && opcode < 110) {
    				if (stackIDs == null) {
    					stackIDs = new int[10];
    					stackAmounts = new int[10];
    				}
    				stackIDs[opcode - 100] = stream.readUnsignedWord();
    				stackAmounts[opcode - 100] = stream.readUnsignedWord();
    			} else if (opcode == 110)
    				anInt167 = stream.readUnsignedWord();
    			else if (opcode == 111)
    				anInt192 = stream.readUnsignedWord();
    			else if (opcode == 112)
    				anInt191 = stream.readUnsignedWord();
    			else if (opcode == 113)
    				anInt196 = stream.readSignedByte();
    			else if (opcode == 114)
    				anInt184 = stream.readSignedByte() * 5;
    			else if (opcode == 115)
    				team = stream.readUnsignedByte();
    			else if (opcode == 139)
    				opcode139 = stream.readUnsignedWord();
    			else if (opcode == 140)
    				opcode140 = stream.readUnsignedWord();
    			else if (opcode == 148)
    				opcode148 = stream.readUnsignedWord();
    			else if (opcode == 149)
    				opcode149 = stream.readUnsignedWord();
    			else {
    				//System.out.println("Error loading item " + id + ", opcode " + opcode);
    			}
    		}
    	}
    	
    	public int opcode139, opcode140, opcode148, opcode149;
    
    	public static void nullLoader() {
    		mruNodes2 = null;
    		mruNodes1 = null;
    		streamIndices = null;
    		cache = null;
    		stream = null;
    	}
    
    	public boolean method192(int j) {
    		int k = anInt175;
    		int l = anInt166;
    		if (j == 1) {
    			k = anInt197;
    			l = anInt173;
    		}
    		if (k == -1)
    			return true;
    		boolean flag = true;
    		if (!Model.method463(k))
    			flag = false;
    		if (l != -1 && !Model.method463(l))
    			flag = false;
    		return flag;
    	}
    
    	public Model method194(int j) {
    		int k = anInt175;
    		int l = anInt166;
    		if (j == 1) {
    			k = anInt197;
    			l = anInt173;
    		}
    		if (k == -1)
    			return null;
    		Model model = Model.method462(k);
    		if (l != -1) {
    			Model model_1 = Model.method462(l);
    			Model aclass30_sub2_sub4_sub6s[] = { model, model_1 };
    			model = new Model(2, aclass30_sub2_sub4_sub6s);
    		}
    		if (modifiedModelColors != null) {
    			for (int i1 = 0; i1 < modifiedModelColors.length; i1++)
    				model.method476(modifiedModelColors[i1], originalModelColors[i1]);
    
    		}
    		return model;
    	}
    
    	public boolean method195(int j) {
    		int k = maleModel;
    		int l = anInt188;
    		int i1 = anInt185;
    		if (j == 1) {
    			k = femaleModel;
    			l = anInt164;
    			i1 = anInt162;
    		}
    		if (k == -1)
    			return true;
    		boolean flag = true;
    		if (!Model.method463(k))
    			flag = false;
    		if (l != -1 && !Model.method463(l))
    			flag = false;
    		if (i1 != -1 && !Model.method463(i1))
    			flag = false;
    		return flag;
    	}
    
    	public Model method196(int i) {
    		int j = maleModel;
    		int k = anInt188;
    		int l = anInt185;
    		if (i == 1) {
    			j = femaleModel;
    			k = anInt164;
    			l = anInt162;
    			
    		}
    		if (j == -1)
    			return null;
    		Model model = Model.method462(j);
    		if (k != -1)
    			if (l != -1) {
    				Model model_1 = Model.method462(k);
    				Model model_3 = Model.method462(l);
    				Model aclass30_sub2_sub4_sub6_1s[] = { model, model_1, model_3 };
    				model = new Model(3, aclass30_sub2_sub4_sub6_1s);
    			} else {
    				Model model_2 = Model.method462(k);
    				Model aclass30_sub2_sub4_sub6s[] = { model, model_2 };
    				model = new Model(2, aclass30_sub2_sub4_sub6s);
    			}
    		if (i == 0 && aByte205 != 0)
    			model.method475(0, aByte205, 0);
    		if (i == 1 && aByte154 != 0)
    			model.method475(0, aByte154, 0);
    		applyTexturing(model, id);
    		if (modifiedModelColors != null) {
    			for (int i1 = 0; i1 < modifiedModelColors.length; i1++)
    				model.method476(modifiedModelColors[i1], originalModelColors[i1]);
    			applyTexturing(model, id);
    
    		}
    		return model;
    	}
    
    	private void setDefaults() {
    		//equipActions = new String[6];
    		equipActions = new String[] {"Remove", null, "Operate", null, null};
    		modelId = 0;
    		name = null;
    		description = null;
    		modifiedModelColors = null;
    		originalModelColors = null;
    		modifiedTextureColors = null;
    		originalTextureColors = null;
    		modelZoom = 2000;
    		modelRotation1 = 0;
    		modelRotation2 = 0;
    		anInt204 = 0;
    		modelOffset1 = 0;
    		modelOffset2 = 0;
    		stackable = false;
    		value = 1;
    		membersObject = false;
    		groundOptions = null;
    		inventoryOptions = null;
    		maleModel = -1;
    		anInt188 = -1;
    		aByte205 = 0;
    		femaleModel = -1;
    		anInt164 = -1;
    		aByte154 = 0;
    		anInt185 = -1;
    		anInt162 = -1;
    		anInt175 = -1;
    		anInt166 = -1;
    		anInt197 = -1;
    		anInt173 = -1;
    		stackIDs = null;
    		stackAmounts = null;
    		certID = -1;
    		certTemplateID = -1;
    		anInt167 = 128;
    		anInt192 = 128;
    		anInt191 = 128;
    		anInt196 = 0;
    		anInt184 = 0;
    		team = 0;
    		
    		opcode140 = -1;
    		opcode139 = -1;
    		opcode148 = -1;
    		opcode149 = -1;
    		
    		searchableItem = false;
    	}
    	
    	public static void dumpBonuses() {
    		int[] bonuses = new int[14];
    		int bonus = 0;
    		int amount = 0;
    		for (int i = 21304; i < totalItems; i++) {
    			ItemDefinition item = ItemDefinition.forID(i);
    			URL url;
    			try {
    				try {
    					try {
    						url = new URL("http://2007.runescape.wikia.com/wiki/"
    								+ item.name.replaceAll(" ", "_"));
    						URLConnection con = url.openConnection();
    						BufferedReader in = new BufferedReader(
    								new InputStreamReader(con.getInputStream()));
    						String line;
    						BufferedWriter writer = new BufferedWriter(
    								new FileWriter("item.cfg", true));
    						while ((line = in.readLine()) != null) {
    							try {
    	                            if (line.contains("<td style=\"text-align: center; width: 35px;\">")) {
    	                                line = line.replace("</td>", "").replace("%", "").replace("?", "").replace("\"\"", "")
    	                                        .replace("<td style=\"text-align: center; width: 35px;\">", "");
    	                                bonuses[bonus] = Integer.parseInt(line);
    	                                bonus++;
    	                            } else if (line.contains("<td style=\"text-align: center; width: 30px;\">")) {
    	                                line = line.replace("</td>", "").replace("%", "").replace("?", "").replace("%", "")
    	                                        .replace("<td style=\"text-align: center; width: 30px;\">", "");
    	                                bonuses[bonus] = Integer.parseInt(line);
    	                                bonus++;
    	                            }
    							} catch (NumberFormatException e) {
    								
    							}
    							if (bonus >= 13)
    								bonus = 0;
    							// in.close();
    						}
    						in.close();
    						writer.write("item	=	" + i + "	"
    								+ item.name.replace(" ", "_") + "	"
    								+ item.description.replace(" ", "_") + "	"
    								+ item.value + "	" + item.value + "	"
    								+ item.value + "	" + bonuses[0] + "	"
    								+ bonuses[1] + "	" + bonuses[2] + "	"
    								+ bonuses[3] + "	" + bonuses[4] + "	"
    								+ bonuses[5] + "	" + bonuses[6] + "	"
    								+ bonuses[7] + "	" + bonuses[8] + "	"
    								+ bonuses[9] + "	" + bonuses[10] + "	"
    								+ bonuses[13]);
    						bonuses[0] = bonuses[1] = bonuses[2] = bonuses[3] = bonuses[4] = bonuses[5] = bonuses[6] = bonuses[7] = bonuses[8] = bonuses[9] = bonuses[10] = bonuses[13] = 0;
    						writer.newLine();
    						amount++;
    						writer.close();
    					} catch (NullPointerException e) {
    
    					}
    				} catch (FileNotFoundException e) {
    
    				}
    			} catch (IOException e) {
    				e.printStackTrace();
    			}
    		}
            System.out.println("Done dumping " + amount + " item bonuses!");
    	}
    	
    	   public static void dumpBonus() {
    	        final int[] wikiBonuses = new int[18];
    	        int bonus = 0;
    	        int amount = 0;
    	        System.out.println("Starting to dump item bonuses...");
       		for (int i = 20000; i < totalItems; i++) {
       			ItemDefinition item = ItemDefinition.forID(i);
    	        try {
    	            try {
    	                try {
    	                    final URL url = new URL("http://2007.runescape.wikia.com/wiki/" + item.name.replaceAll(" ", "_"));
    	                    URLConnection con = url.openConnection();
    	                    BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
    	                    String line;
    	                    writer = new BufferedWriter(new FileWriter("item.cfg", true));
    	                    while ((line = in.readLine()) != null) {
    	                        try {
    	                            if (line.contains("<td style=\"text-align: center; width: 35px;\">")) {
    	                                line = line.replace("</td>", "").replace("%", "").replace("?", "").replace("\"\"", "")
    	                                        .replace("<td style=\"text-align: center; width: 35px;\">", "");
    	                                wikiBonuses[bonus] = Integer.parseInt(line);
    	                                bonus++;
    	                            } else if (line.contains("<td style=\"text-align: center; width: 30px;\">")) {
    	                                line = line.replace("</td>", "").replace("%", "").replace("?", "").replace("%", "")
    	                                        .replace("<td style=\"text-align: center; width: 30px;\">", "");
    	                                wikiBonuses[bonus] = Integer.parseInt(line);
    	                                bonus++;
    	                            }
    	                        } catch (NumberFormatException e) {
    	                            e.printStackTrace();
    	                    }
    	                    in.close();
    	                    writer.write("item = " + i + "	" + item.name.replace(" ", "_") + "	"
    								+ item.description.replace(" ", "_") + "	" + item.value + "	" + item.value + "	"
    								+ item.value + "	" + wikiBonuses[0] + "	" + wikiBonuses[1] + "	" + wikiBonuses[2] + "	" + wikiBonuses[3]
    								+ "	" + wikiBonuses[4] + "	" + wikiBonuses[5] + "	" + wikiBonuses[6] + "	" + wikiBonuses[7] + "	"
    								+ wikiBonuses[8] + "	" + wikiBonuses[9] + "	" + wikiBonuses[10] + "	" + wikiBonuses[13]);
    	                    amount++;
    	                    wikiBonuses[0] = wikiBonuses[1] = wikiBonuses[2] = wikiBonuses[3] = wikiBonuses[4] = wikiBonuses[5] = wikiBonuses[6] = wikiBonuses[7] = wikiBonuses[8] = wikiBonuses[9] = wikiBonuses[10] = wikiBonuses[11] = wikiBonuses[13] = 0;
    	                    writer.newLine();
    	                    writer.close();
    	                	}
    	                } catch (NullPointerException e) {
    	                    e.printStackTrace();
    	                }
    	            } catch (FileNotFoundException e) {
    	                e.printStackTrace();
    	            }
    	        } catch (IOException e) {
    	            e.printStackTrace();
    	        }
    	        System.out.println("Done dumping " + amount + " item bonuses!");
       		}
    	 }
    	 
    	 public static void dumpItemDefs() {
    	        final int[] wikiBonuses = new int[18];
    	        int bonus = 0;
    	        int amount = 0;
    			int value = 0;
    			int slot = -1;
    			//Testing Variables just so i know format is correct
    			String fullmask = "false";
    			//boolean stackable1 = false;
    			String stackable = "false";
    			//boolean noteable1 = false;
    			String noteable = "true";
    			//boolean tradeable1 = false;
    			String tradeable = "true";
    			//boolean wearable1 = false;
    			String wearable = "true";
    			String showBeard = "true";
    			String members = "true";
    			boolean twoHanded = false;
    	        System.out.println("Starting to dump item definitions...");
       		for (int i = 21298; i < totalItems; i++) {
       			ItemDefinition item = ItemDefinition.forID(i);
    	        try {
    	            try {
    	                try {
    	                    final URL url = new URL("http://2007.runescape.wikia.com/wiki/" + item.name.replaceAll(" ", "_"));
    	                    URLConnection con = url.openConnection();
    	                    BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
    	                    String line;
    	                    writer = new BufferedWriter(new FileWriter("itemDefs.json", true));
    	                    while ((line = in.readLine()) != null) {
    	                        try {
    	                            if (line.contains("<td style=\"text-align: center; width: 35px;\">")) {
    	                                line = line.replace("</td>", "").replace("%", "").replace("?", "").replace("\"\"", "")
    	                                        .replace("<td style=\"text-align: center; width: 35px;\">", "");
    	                                wikiBonuses[bonus] = Integer.parseInt(line);
    	                                bonus++;
    	                            } else if (line.contains("<td style=\"text-align: center; width: 30px;\">")) {
    	                                line = line.replace("</td>", "").replace("%", "").replace("?", "").replace("%", "")
    	                                        .replace("<td style=\"text-align: center; width: 30px;\">", "");
    	                                wikiBonuses[bonus] = Integer.parseInt(line);
    	                                bonus++;
    								}
    	                            if (line.contains("<div id=\"GEPCalcResult\" style=\"display:inline;\">")) {
    									line = line.replace("</div>", "").replace("%", "").replace("?", "").replace("%", "")
    											.replace("<div id=\"GEPCalcResult\" style=\"display:inline;\">", "");
    									value = Integer.parseInt(line);
    								}
    									
    	                        } catch (NumberFormatException e) {
    	                            e.printStackTrace();
    	                    }
    	                    in.close();
    						//fw.write("ItemID: "+itemDefinition.id+" - "+itemDefinition.name);
    						//fw.write(System.getProperty("line.separator"));
    						//writer.write("[\n");
    						writer.write("  {\n\t\"id\": "+ item.id +",\n\t\"name\": \""+ item.name +"\",\n\t\"desc\": \""+ item.description.replace("_", " ") +"\",\n\t\"value\": "+ value +",\n\t\"dropValue\": "+ value +",\n\t\"bonus\": [\n\t  "+ wikiBonuses[0] +",\n\t  "+ wikiBonuses[1] +",\n\t  "+ wikiBonuses[2] +",\n\t  "+ wikiBonuses[3] +",\n\t  "+ wikiBonuses[4] +",\n\t  "+ wikiBonuses[5] +",\n\t  "+ wikiBonuses[6] +",\n\t  "+ wikiBonuses[7] +",\n\t  "+ wikiBonuses[8] +",\n\t  "+ wikiBonuses[9] +",\n\t  "+ wikiBonuses[10] +",\n\t  "+ wikiBonuses[13] +",\n\t],\n\t\"slot\": "+ slot +",\n\t\"fullmask\": "+ fullmask +",\n\t\"stackable\": "+ stackable +",\n\t\"noteable\": "+ noteable +",\n\t\"tradeable\": "+ tradeable +",\n\t\"wearable\": "+ wearable +",\n\t\"showBeard\": "+ showBeard +",\n\t\"members\": "+ members +",\n\t\"slot\": "+ twoHanded +",\n\t\"requirements\": [\n\t  0,\n\t  0,\n\t  0,\n\t  0,\n\t  0,\n\t  0,\n\t  0,\n\t  0,\n\t  0,\n\t  0,\n\t  0,\n\t  0,\n\t  0,\n\t  0,\n\t  0,\n\t  0,\n\t  0,\n\t  0,\n\t  0,\n\t  0,\n\t  0,\n\t]\n  },\n");
    	                    /*writer.write("item = " + i + "	" + item.name.replace(" ", "_") + "	"
    								+ item.description.replace(" ", "_") + "	" + item.value + "	" + item.value + "	"
    								+ item.value + "	" + wikiBonuses[0] + "	" + wikiBonuses[1] + "	" + wikiBonuses[2] + "	" + wikiBonuses[3]
    								+ "	" + wikiBonuses[4] + "	" + wikiBonuses[5] + "	" + wikiBonuses[6] + "	" + wikiBonuses[7] + "	"
    								+ wikiBonuses[8] + "	" + wikiBonuses[9] + "	" + wikiBonuses[10] + "	" + wikiBonuses[13]);*/
    	                    amount++;
    	                    wikiBonuses[0] = wikiBonuses[1] = wikiBonuses[2] = wikiBonuses[3] = wikiBonuses[4] = wikiBonuses[5] = wikiBonuses[6] = wikiBonuses[7] = wikiBonuses[8] = wikiBonuses[9] = wikiBonuses[10] = wikiBonuses[11] = wikiBonuses[13] = 0;
    	                    writer.newLine();
    	                    writer.close();
    	                	}
    	                } catch (NullPointerException e) {
    	                    e.printStackTrace();
    	                }
    	            } catch (FileNotFoundException e) {
    	                e.printStackTrace();
    	            }
    	        } catch (IOException e) {
    	            e.printStackTrace();
    	        }
    	        System.out.println("Done dumping " + amount + " item definitions!");
       		}
    	 }
    	 
    	   public static void dumpList() {
    			try {
    				FileWriter fw = new FileWriter(System.getProperty("user.home")+"/Desktop/itemList "+Configuration.dumpID+".txt");
    				for (int i = 0; i < totalItems; i++) {
    					ItemDefinition itemDefinition = ItemDefinition.forID(i);
    					fw.write("ItemID: "+itemDefinition.id+" - "+itemDefinition.name);
    					fw.write(System.getProperty("line.separator"));
    				}
    				fw.close();
    			} catch (Exception e) {
    				System.out.println(e);
    			}
    		}
    		
    		public static void dumpStackableList() {
    			try {
    				File file = new File("stackables.dat");
    				
    				if (!file.exists()) {
    					file.createNewFile();
    				}
    				
    				try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) {
    					for (int i = 0; i < totalItems; i++) {
    						ItemDefinition definition = forID(i);
    						if (definition != null) {
    							writer.write(definition.id + "\t" + definition.stackable);
    							writer.newLine();
    						} else {
    							writer.write(i + "\tfalse");
    							writer.newLine();
    						}
    					}
    				}
    				
    				System.out.println("Finished dumping noted items definitions.");
    			} catch (Exception e) {
    				e.printStackTrace();
    			}
    		}
    		
    		public static int[] unNoteable = {};
    		
    		public static void dumpNotes() {
    			try {
    				FileOutputStream out = new FileOutputStream(new File("notes.dat"));
    				for (int j = 0; j < totalItems; j++) {
    					ItemDefinition item = ItemDefinition.forID(j);
    					for(int i = 0; i < totalItems; i++)
    						if (j == unNoteable[i] + 1)
    							out.write(0);
    						else
    							out.write(item.certTemplateID != -1 ? 0 : 1);
    				}
    				out.write(-1);
    				out.close();
    			} catch (IOException ioe) {ioe.printStackTrace();}
    		}
    		
    	    public static void dumpStackable() {
    			try {
    				FileOutputStream out = new FileOutputStream(new File("stackable.dat"));
    				for (int j = 0; j < totalItems; j++) {
    					ItemDefinition item = ItemDefinition.forID(j);
    					out.write(item.stackable ? 1 : 0);
    				}
    				out.write(-1);
    				out.close();
    			} catch (IOException ioe) {ioe.printStackTrace();}	
    		}
    		
    		public static void dumpNotableList() {
    			try {
    				File file = new File("note_id.dat");
    				
    				if (!file.exists()) {
    					file.createNewFile();
    				}
    				
    				try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) {
    					for (int i = 0; i < totalItems; i++) {
    						ItemDefinition definition = ItemDefinition.forID(i);
    						if (definition != null) {
    							if (definition.certTemplateID == -1 && definition.certID != -1) {
    								writer.write(definition.id + "\t" + definition.certID);
    								writer.newLine();
    							}
    						} else {
    							writer.write(i + "\t-1");
    							writer.newLine();
    						}
    					}
    				}
    				
    				System.out.println("Finished dumping noted items definitions.");
    			} catch (Exception e) {
    				e.printStackTrace();
    			}
    		}
    
    	private void toNote() {
    		ItemDefinition itemDef = forID(certTemplateID);
    		modelId = itemDef.modelId;
    		modelZoom = itemDef.modelZoom;
    		modelRotation1 = itemDef.modelRotation1;
    		modelRotation2 = itemDef.modelRotation2;
    
    		anInt204 = itemDef.anInt204;
    		modelOffset1 = itemDef.modelOffset1;
    		modelOffset2 = itemDef.modelOffset2;
    		modifiedModelColors = itemDef.modifiedModelColors;
    		originalModelColors = itemDef.originalModelColors;
    		ItemDefinition itemDef_1 = forID(certID);
    		name = itemDef_1.name;
    		membersObject = itemDef_1.membersObject;
    		value = itemDef_1.value;
    		String s = "a";
    		char c = itemDef_1.name.charAt(0);
    		if (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U')
    			s = "an";
    		description = ("Swap this note at any bank for " + s + " " + itemDef_1.name + ".");
    		stackable = true;
    	}
    	
    	public static Sprite getSmallSprite(int itemId) {
    		ItemDefinition itemDef = forID(itemId);
    		Model model = itemDef.method201(1);
    		if (model == null) {
    			return null;
    		}
    		Sprite sprite1 = null;
    		if (itemDef.certTemplateID != -1) {
    			sprite1 = getSprite(itemDef.certID, 10, -1);
    			if (sprite1 == null) {
    				return null;
    			}
    		}
    		Sprite enabledSprite = new Sprite(18, 18);
    		int k1 = Texture.textureInt1;
    		int l1 = Texture.textureInt2;
    		int ai[] = Texture.anIntArray1472;
    		int ai1[] = DrawingArea.pixels;
    		int i2 = DrawingArea.width;
    		int j2 = DrawingArea.height;
    		int k2 = DrawingArea.topX;
    		int l2 = DrawingArea.bottomX;
    		int i3 = DrawingArea.topY;
    		int j3 = DrawingArea.bottomY;
    		Texture.aBoolean1464 = false;
    		DrawingArea.initDrawingArea(18, 18, enabledSprite.myPixels);
    		DrawingArea.method336(18, 0, 0, 0, 18);
    		Texture.method364();
    		int k3 = (int) (itemDef.modelZoom * 1.6D);
    		int l3 = Texture.anIntArray1470[itemDef.modelRotation1] * k3 >> 16;
    		int i4 = Texture.anIntArray1471[itemDef.modelRotation1] * k3 >> 16;
    		model.method482(itemDef.modelRotation2, itemDef.anInt204, itemDef.modelRotation1, itemDef.modelOffset1, l3 + model.modelHeight / 2 + itemDef.modelOffset2, i4 + itemDef.modelOffset2);
    		if (itemDef.certTemplateID != -1) {
    			int l5 = sprite1.maxWidth;
    			int j6 = sprite1.maxHeight;
    			sprite1.maxWidth = 18;
    			sprite1.maxHeight = 18;
    			sprite1.drawSprite(0, 0);
    			sprite1.maxWidth = l5;
    			sprite1.maxHeight = j6;
    		}
    		DrawingArea.initDrawingArea(j2, i2, ai1);
    		DrawingArea.setDrawingArea(j3, k2, l2, i3);
    		Texture.textureInt1 = k1;
    		Texture.textureInt2 = l1;
    		Texture.anIntArray1472 = ai;
    		Texture.aBoolean1464 = true;
    		
    		enabledSprite.maxWidth = 18;
    		enabledSprite.maxHeight = 18;
    		
    		return enabledSprite;
    	}
    
    	public static Sprite getSprite(int itemId, int itemAmount, int highlightColor) {
    		if (highlightColor == 0) {
    			Sprite sprite = (Sprite) mruNodes1.insertFromCache(itemId);
    			if (sprite != null && sprite.maxHeight != itemAmount && sprite.maxHeight != -1) {
    				sprite.unlink();
    				sprite = null;
    			}
    			if (sprite != null)
    				return sprite;
    		}
    		ItemDefinition itemDef = forID(itemId);
    		if (itemDef.stackIDs == null)
    			itemAmount = -1;
    		if (itemAmount > 1) {
    			int i1 = -1;
    			for (int j1 = 0; j1 < 10; j1++)
    				if (itemAmount >= itemDef.stackAmounts[j1] && itemDef.stackAmounts[j1] != 0)
    					i1 = itemDef.stackIDs[j1];
    
    			if (i1 != -1)
    				itemDef = forID(i1);
    		}
    		Model model = itemDef.method201(1);
    		if (model == null)
    			return null;
    		Sprite sprite = null;
    		if (itemDef.certTemplateID != -1) {
    			sprite = getSprite(itemDef.certID, 10, -1);
    			if (sprite == null)
    				return null;
    		} else if (itemDef.opcode140 != -1) {
    			sprite = getSprite(itemDef.opcode139, itemAmount, -1);
    			if (sprite == null)
    				return null;
    		} else if (itemDef.opcode149 != -1) {
    			sprite = getSprite(itemDef.opcode148, itemAmount, -1);
    			if (sprite == null)
    				return null;
    		}
    		Sprite sprite2 = new Sprite(32, 32);
    		int k1 = Texture.textureInt1;
    		int l1 = Texture.textureInt2;
    		int ai[] = Texture.anIntArray1472;
    		int ai1[] = DrawingArea.pixels;
    		int i2 = DrawingArea.width;
    		int j2 = DrawingArea.height;
    		int k2 = DrawingArea.topX;
    		int l2 = DrawingArea.bottomX;
    		int i3 = DrawingArea.topY;
    		int j3 = DrawingArea.bottomY;
    		Texture.aBoolean1464 = false;
    		DrawingArea.initDrawingArea(32, 32, sprite2.myPixels);
    		DrawingArea.method336(32, 0, 0, 0, 32);
    		Texture.method364();
    		if (itemDef.opcode149 != -1) {
    			int l5 = sprite.maxWidth;
    			int j6 = sprite.maxHeight;
    			sprite.maxWidth = 32;
    			sprite.maxHeight = 32;
    			sprite.drawSprite(0, 0);
    			sprite.maxWidth = l5;
    			sprite.maxHeight = j6;
    		}
    		int k3 = itemDef.modelZoom;
    		if (highlightColor == -1)
    			k3 = (int) ((double) k3 * 1.5D);
    		if (highlightColor > 0)
    			k3 = (int) ((double) k3 * 1.04D);
    		int l3 = Texture.anIntArray1470[itemDef.modelRotation1] * k3 >> 16;
    		int i4 = Texture.anIntArray1471[itemDef.modelRotation1] * k3 >> 16;
    		model.method482(itemDef.modelRotation2, itemDef.anInt204, itemDef.modelRotation1, itemDef.modelOffset1,
    				l3 + model.modelHeight / 2 + itemDef.modelOffset2, i4 + itemDef.modelOffset2);
    		if (itemDef.opcode140 != -1) {
    			int l5 = sprite.maxWidth;
    			int j6 = sprite.maxHeight;
    			sprite.maxWidth = 32;
    			sprite.maxHeight = 32;
    			sprite.drawSprite(0, 0);
    			sprite.maxWidth = l5;
    			sprite.maxHeight = j6;
    		}
    		for (int i5 = 31; i5 >= 0; i5--) {
    			for (int j4 = 31; j4 >= 0; j4--)
    				if (sprite2.myPixels[i5 + j4 * 32] == 0)
    					if (i5 > 0 && sprite2.myPixels[(i5 - 1) + j4 * 32] > 1)
    						sprite2.myPixels[i5 + j4 * 32] = 1;
    					else if (j4 > 0 && sprite2.myPixels[i5 + (j4 - 1) * 32] > 1)
    						sprite2.myPixels[i5 + j4 * 32] = 1;
    					else if (i5 < 31 && sprite2.myPixels[i5 + 1 + j4 * 32] > 1)
    						sprite2.myPixels[i5 + j4 * 32] = 1;
    					else if (j4 < 31 && sprite2.myPixels[i5 + (j4 + 1) * 32] > 1)
    						sprite2.myPixels[i5 + j4 * 32] = 1;
    
    		}
    
    		if (highlightColor > 0) {
    			for (int j5 = 31; j5 >= 0; j5--) {
    				for (int k4 = 31; k4 >= 0; k4--)
    					if (sprite2.myPixels[j5 + k4 * 32] == 0)
    						if (j5 > 0 && sprite2.myPixels[(j5 - 1) + k4 * 32] == 1)
    							sprite2.myPixels[j5 + k4 * 32] = highlightColor;
    						else if (k4 > 0 && sprite2.myPixels[j5 + (k4 - 1) * 32] == 1)
    							sprite2.myPixels[j5 + k4 * 32] = highlightColor;
    						else if (j5 < 31 && sprite2.myPixels[j5 + 1 + k4 * 32] == 1)
    							sprite2.myPixels[j5 + k4 * 32] = highlightColor;
    						else if (k4 < 31 && sprite2.myPixels[j5 + (k4 + 1) * 32] == 1)
    							sprite2.myPixels[j5 + k4 * 32] = highlightColor;
    
    			}
    
    		} else if (highlightColor == 0) {
    			for (int k5 = 31; k5 >= 0; k5--) {
    				for (int l4 = 31; l4 >= 0; l4--)
    					if (sprite2.myPixels[k5 + l4 * 32] == 0 && k5 > 0 && l4 > 0
    							&& sprite2.myPixels[(k5 - 1) + (l4 - 1) * 32] > 0)
    						sprite2.myPixels[k5 + l4 * 32] = 0x302020;
    
    			}
    
    		}
    		if (itemDef.certTemplateID != -1) {
    			int l5 = sprite.maxWidth;
    			int j6 = sprite.maxHeight;
    			sprite.maxWidth = 32;
    			sprite.maxHeight = 32;
    			sprite.drawSprite(0, 0);
    			sprite.maxWidth = l5;
    			sprite.maxHeight = j6;
    		}
    		if (highlightColor == 0)
    			mruNodes1.removeFromCache(sprite2, itemId);
    		DrawingArea.initDrawingArea(j2, i2, ai1);
    		DrawingArea.setDrawingArea(j3, k2, l2, i3);
    		Texture.textureInt1 = k1;
    		Texture.textureInt2 = l1;
    		Texture.anIntArray1472 = ai;
    		Texture.aBoolean1464 = true;
    		if (itemDef.stackable)
    			sprite2.maxWidth = 33;
    		else
    			sprite2.maxWidth = 32;
    		sprite2.maxHeight = itemAmount;
    		return sprite2;
    	}
    
    	
    	public Model method201(int i) {
    		if (stackIDs != null && i > 1) {
    			int j = -1;
    			for (int k = 0; k < 10; k++)
    				if (i >= stackAmounts[k] && stackAmounts[k] != 0)
    					j = stackIDs[k];
    
    			if (j != -1)
    				return forID(j).method201(1);
    		}
    		Model model = (Model) mruNodes2.insertFromCache(id);
    		if (model != null)
    			return model;
    		model = Model.method462(modelId);
    		if (model == null)
    			return null;
    		applyTexturing(model, id);
    		if (anInt167 != 128 || anInt192 != 128 || anInt191 != 128)
    			model.method478(anInt167, anInt191, anInt192);
    		if (modifiedModelColors != null) {
    			for (int l = 0; l < modifiedModelColors.length; l++)
    				model.method476(modifiedModelColors[l], originalModelColors[l]);
    
    		}
    		model.method479(64 + anInt196, 768 + anInt184, -50, -10, -50, true);
    		model.aBoolean1659 = true;
    		mruNodes2.removeFromCache(model, id);
    		return model;
    	}
    
    	public Model method202(int i) {
    		if (stackIDs != null && i > 1) {
    			int j = -1;
    			for (int k = 0; k < 10; k++)
    				if (i >= stackAmounts[k] && stackAmounts[k] != 0)
    					j = stackIDs[k];
    
    			if (j != -1)
    				return forID(j).method202(1);
    		}
    		Model model = Model.method462(modelId);
    		if (model == null)
    			return null;
    		if (modifiedModelColors != null) {
    			for (int l = 0; l < modifiedModelColors.length; l++)
    				model.method476(modifiedModelColors[l], originalModelColors[l]);
    
    		}
    		return model;
    	}
    
    	private ItemDefinition() {
    		id = -1;
    	}
    
    	private byte aByte154;
    	public int value;
    	public int[] originalModelColors;
    	public int[] modifiedModelColors;
    	
    	private short[] originalTextureColors;
    	private short[] modifiedTextureColors;
    
    	public int id;
    	public static MRUNodes mruNodes1 = new MRUNodes(100);
    	public static MRUNodes mruNodes2 = new MRUNodes(50);
    
    	public boolean membersObject;
    	private int anInt162;
    	public int certTemplateID;
    	private int anInt164;
    	public int maleModel;
    	private int anInt166;
    	private int anInt167;
    	public String groundOptions[];
    	public int modelOffset1;
    	public String name;
    	private static ItemDefinition[] cache;
    	private int anInt173;
    	public int modelId;
    	private int anInt175;
    	public boolean stackable;
    	public String description;
    	public int certID;
    	private static int cacheIndex;
    	public int modelZoom;
    	private static Stream stream;
    	private int anInt184;
    	private int anInt185;
    	private int anInt188;
    	public String inventoryOptions[];
    	public String equipActions[];
    	public int modelRotation1;
    	private int anInt191;
    	private int anInt192;
    	private int[] stackIDs;
    	public int modelOffset2;
    	private static int[] streamIndices;
    	private int anInt196;
    	private int anInt197;
    	public int modelRotation2;
    	public int femaleModel;
    	private int[] stackAmounts;
    	public int team;
    	public static int totalItems;
    	private int anInt204;
    	private byte aByte205;
    	public boolean searchableItem;
    	private static BufferedWriter writer;
    
    }
    Reply With Quote  
     

  2. #2  
    Registered Member
    Selseus's Avatar
    Join Date
    Aug 2017
    Posts
    386
    Thanks given
    11
    Thanks received
    73
    Rep Power
    84
    Going in wrong slot: I don't know where your wearing definitions are handled, but usually it's in items.txt, but change "Equip_type" to "Equip_type CAPE"

    if it's going into the right slot, but your head is dissapearing, your male/female equip model either isn't in the cache right, or your modelID is wrong.

    Nothing else working but models are right and load right, just not displaying correctly in-game?: you need a new model header (for some reason)
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Jan 2016
    Posts
    106
    Thanks given
    16
    Thanks received
    14
    Rep Power
    69
    Quote Originally Posted by Selseus View Post
    Going in wrong slot: I don't know where your wearing definitions are handled, but usually it's in items.txt, but change "Equip_type" to "Equip_type CAPE"

    if it's going into the right slot, but your head is dissapearing, your male/female equip model either isn't in the cache right, or your modelID is wrong.

    Nothing else working but models are right and load right, just not displaying correctly in-game?: you need a new model header (for some reason)
    Thanks for your reply, checked and it's going in the right slot, what is modelId for infernal?
    Reply With Quote  
     

  4. #4  
    Registered Member
    Selseus's Avatar
    Join Date
    Aug 2017
    Posts
    386
    Thanks given
    11
    Thanks received
    73
    Rep Power
    84
    Quote Originally Posted by Too Moist View Post
    Thanks for your reply, checked and it's going in the right slot, what is modelId for infernal?
    I currently don't have any servers loading that revision of cache

    if you're actually loading the real revision cache and these aren't custom or imported manually, you probably could use Lin's Cache Suite to view all the models. Idk if it supports OSRS data, but worth a try. If not, dump the index and use datmaker and check the models.
    Reply With Quote  
     

  5. #5  
    Donator


    Join Date
    Dec 2014
    Posts
    369
    Thanks given
    77
    Thanks received
    112
    Rep Power
    164
    Internal cape? Eww
    Reply With Quote  
     

  6. Thankful user:



Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 29
    Last Post: 04-18-2008, 02:44 AM
  2. Skill Capes
    By Itachi Uchiha in forum Tutorials
    Replies: 33
    Last Post: 09-20-2007, 12:15 AM
  3. Fully working CWars Capes AND Team Capes!
    By Fr33b1e in forum Tutorials
    Replies: 11
    Last Post: 08-14-2007, 07:58 AM
  4. Making TEAM CAPES
    By CLOUD The STRIFE in forum Tutorials
    Replies: 5
    Last Post: 07-24-2007, 04:53 PM
  5. New fire cape client with moving fire cape ^^
    By YeahSon in forum Downloads
    Replies: 4
    Last Post: 07-04-2007, 10:53 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •