public static void createItems(String[] data) { CommandGenerator.log("Creating Items..."); for (String item : data) { String[] values = item.split(","); String idString = values[1], damage = null; int idInt = Integer.parseInt(values[0]), maxDamage = 0, langType = 0, textureType = 0; for (String a : values) { if (a.startsWith("durability=")) { langType = -1; textureType = -1; maxDamage = Integer.parseInt(a.substring("durability=".length())); } else if (a.startsWith("damage=")) maxDamage = Integer.parseInt(a.substring("damage=".length())); else if (a.startsWith("lang=")) langType = Integer.parseInt(a.substring("lang=".length())); else if (a.startsWith("texture=")) textureType = Integer.parseInt(a.substring("texture=".length())); else if (a.startsWith("damage_custom=")) damage = a.substring("damage_custom=".length()); else if (a.startsWith("lists=")) addToLists(idString, a.substring("lists=".length()).split(":")); } Item i; if (damage == null) i = new Item(idInt, idString, maxDamage); else i = new Item(idInt, idString, createDamage(damage)); i.langType = langType; i.textureType = textureType; } CommandGenerator.log("Successfully created " + items.size() + " items."); }
public static void createBlocks(String[] data) { CommandGenerator.log("Creating Blocks..."); blocks.clear(); blockIDs.clear(); items.clear(); itemIDs.clear(); for (String block : data) { String[] values = block.split(","); String idString = values[1], damage = null; int idInt = Integer.parseInt(values[0]), maxDamage = 0, langType = 0, textureType = 0; boolean item = true; for (String a : values) { if (a.startsWith("damage=")) maxDamage = Integer.parseInt(a.substring("damage=".length())); else if (a.startsWith("lang=")) langType = Integer.parseInt(a.substring("lang=".length())); else if (a.startsWith("texture=")) textureType = Integer.parseInt(a.substring("texture=".length())); else if (a.startsWith("damage_custom=")) damage = a.substring("damage_custom=".length()); else if (a.equals("blockOnly")) item = false; else if (a.startsWith("lists=")) addToLists(idString, a.substring("lists=".length()).split(":")); } Block b; if (damage == null) b = new Block(idInt, idString, maxDamage); else b = new Block(idInt, idString, createDamage(damage)); b.langType = langType; b.textureType = textureType; if (item) { Item i; if (damage == null) i = new Item(idInt, idString, maxDamage); else i = new Item(idInt, idString, createDamage(damage)); i.langType = langType; i.textureType = textureType; } } CommandGenerator.log("Successfully created " + blocks.size() + " blocks."); }