u want to add them under a switch statement
https://docs.oracle.com/javase/tutor...ts/switch.html
|
i do beleive its suppose to be an if itemDef or something, becauseCode:public static ItemDef forID(int i) { for (int j = 0; j < 10; j++) if (cache[j].ID == i) return cache[j]; cacheIndex = (cacheIndex + 1) % 10; ItemDef itemDef = cache[cacheIndex]; stream.currentOffset = streamIndices[i]; itemDef.ID = i; itemDef.setDefaults(); itemDef.readValues(stream); if (itemDef.certTemplateID != -1) itemDef.toNote(); if (itemDef.lentItemID != -1) itemDef.toLend(); if (!isMembers && itemDef.membersObject) { itemDef.name = "Members Object"; itemDef.description = "Login to a members' server to use this object."; itemDef.groundActions = null; itemDef.actions = null; itemDef.team = 0; } if (itemDef.editedModelColor != null) { for (int i2 = 0; i2 < itemDef.editedModelColor.length; i2++) { if (itemDef.newModelColor[i2] == 0) { itemDef.newModelColor[i2] = 1; } } } return itemDef; //**Custom items**\\ case 20290: itemDef.ID = 20290; itemDef.actions = new String[] { null, "Wear", "Revert", null, "Drop" }; itemDef.modelID = 42724; itemDef.maleEquip1 = 42734; itemDef.femaleEquip1 = 42737; itemDef.modelZoom = 750; itemDef.modelRotation1 = 1743; itemDef.modelRotation2 = 69; itemDef.modelOffset1 = -4; itemDef.modelOffset2 = -3; break;case 20290: is an error codeCode:case 20290:
u want to add them under a switch statement
https://docs.oracle.com/javase/tutor...ts/switch.html
yeah i unfortunately dont even have any switch statements in my itemdef
figured it out, wrote that one it workspublic static ItemDef itemDef(int i, ItemDef itemDef) {
if(i == 20290) {
itemDef.ID = 20290;
itemDef.actions = new String[] { null, "Wear", "Revert", null, "Drop" };
itemDef.modelID = 42724;
itemDef.maleEquip1 = 42734;
itemDef.femaleEquip1 = 42737;
itemDef.modelZoom = 750;
itemDef.modelRotation1 = 1743;
itemDef.modelRotation2 = 69;
itemDef.modelOffset1 = -4;
itemDef.modelOffset2 = -3;
}
you can open a switch statement and add items in it like this:
yours should look something like this just make sure the switch statement is inside the forID method:Code:switch (i) { case 1234: //number is the (i) which is meant to be the item id. //your code here for the item's definitions. break; // to end the case }
try to add it in yourself and not to copy and pasteCode:public static ItemDef forID(int i) { for (int j = 0; j < 10; j++) if (cache[j].ID == i) return cache[j]; cacheIndex = (cacheIndex + 1) % 10; ItemDef itemDef = cache[cacheIndex]; stream.currentOffset = streamIndices[i]; itemDef.ID = i; itemDef.setDefaults(); itemDef.readValues(stream); if (itemDef.certTemplateID != -1) itemDef.toNote(); if (itemDef.lentItemID != -1) itemDef.toLend(); if (!isMembers && itemDef.membersObject) { itemDef.name = "Members Object"; itemDef.description = "Login to a members' server to use this object."; itemDef.groundActions = null; itemDef.actions = null; itemDef.team = 0; } if (itemDef.editedModelColor != null) { for (int i2 = 0; i2 < itemDef.editedModelColor.length; i2++) { if (itemDef.newModelColor[i2] == 0) { itemDef.newModelColor[i2] = 1; } } } switch(i){ case 20290: itemDef.ID = 20290; itemDef.actions = new String[] { null, "Wear", "Revert", null, "Drop" }; itemDef.modelID = 42724; itemDef.maleEquip1 = 42734; itemDef.femaleEquip1 = 42737; itemDef.modelZoom = 750; itemDef.modelRotation1 = 1743; itemDef.modelRotation2 = 69; itemDef.modelOffset1 = -4; itemDef.modelOffset2 = -3; break; } return itemDef; }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |