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 createAchievements(String[] data) { CommandGenerator.log("Creating Achievements..."); achievements.clear(); for (String a : data) { String[] values = a.split(","); new Achievement(values[0], getItemFromID(values[1])); } CommandGenerator.log("Successfully created " + achievements.size() + " achievements."); }
public static void createEnchantments(String[] data) { CommandGenerator.log("Creating Enchantments..."); enchantments.clear(); enchantmentIDs.clear(); for (String a : data) { String[] values = a.split(","); new EnchantmentType(Integer.parseInt(values[0]), values[1], Integer.parseInt(values[2])); } CommandGenerator.log("Successfully created " + enchantments.size() + " enchantments."); }
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."); }
public static void createAttributes(String[] data) { CommandGenerator.log("Creating Attributes..."); attributes.clear(); for (String id : data) new Attribute(id); CommandGenerator.log("Successfully created " + attributes.size() + " attributes."); }
public static void createSounds(String[] data) { CommandGenerator.log("Creating Sounds..."); sounds.clear(); for (String id : data) new Sound(id); CommandGenerator.log("Successfully created " + sounds.size() + " sounds."); }
public static void createParticles(String[] data) { CommandGenerator.log("Creating Particles..."); particles.clear(); for (String id : data) new Particle(id); CommandGenerator.log("Successfully created " + particles.size() + " particles."); }
public static void createObjects() { String[] data = FileUtils.readFileAsArray("data/" + Settings.getVersion().name + ".txt"); ArrayList<String> blocks = new ArrayList<String>(), items = new ArrayList<String>(), entities = new ArrayList<String>(), effects = new ArrayList<String>(), enchantments = new ArrayList<String>(), achievements = new ArrayList<String>(), attributes = new ArrayList<String>(), particles = new ArrayList<String>(), sounds = new ArrayList<String>(); int current = -1; for (String line : data) { if (line.startsWith("[")) { ++current; continue; } switch (current) { case 0: blocks.add(line); break; case 1: items.add(line); break; case 2: String[] e = line.split(","); for (String entity : e) entities.add(entity); break; case 3: effects.add(line); break; case 4: enchantments.add(line); break; case 5: achievements.add(line); break; case 6: String[] a = line.split(","); for (String attribute : a) attributes.add(attribute); break; case 7: String[] p = line.split(","); for (String particle : p) particles.add(particle); break; case 8: String[] s = line.split(","); for (String sound : s) sounds.add(sound); break; } } createBlocks(blocks.toArray(new String[blocks.size()])); createItems(items.toArray(new String[items.size()])); createEntities(entities.toArray(new String[entities.size()])); createEffects(effects.toArray(new String[effects.size()])); createEnchantments(enchantments.toArray(new String[enchantments.size()])); createAchievements(achievements.toArray(new String[achievements.size()])); createAttributes(attributes.toArray(new String[attributes.size()])); createParticles(particles.toArray(new String[particles.size()])); createSounds(sounds.toArray(new String[sounds.size()])); CommandGenerator.log("Successfully created " + objectLists.size() + " object lists."); TargetArgument.createArguments(); }
public static void createEntities(String[] data) { CommandGenerator.log("Creating Entities..."); entities.clear(); for (String id : data) new Entity(id); CommandGenerator.log("Successfully created " + entities.size() + " entities."); }