Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void generateInfo(ItemStack stack) {
- if (stack == null)
- return;
- Item item = stack.getItem();
- if (item != null && item.getItemName() != null) {
- ItemWrap wrap = new ItemWrap(stack);
- String[] tips = new String[] {};
- if (item instanceof ItemBlock) {
- tips = addToArray(tips, "Placeable Block");
- Block block = Block.blocksList[((ItemBlock) item).getBlockID()];
- if (block != null) {
- if (block.canProvidePower())
- tips = addToArray(tips, "Redstone Powered");
- }
- }
- if (item.getItemEnchantability() > 0)
- tips = addToArray(tips, "Enchantable");
- boolean isArmor = false;
- if (item.isItemTool(stack)) {
- String type = "Tool";
- if (item instanceof ItemArmor) {
- isArmor = true;
- switch (((ItemArmor) item).armorType) {
- case 0:
- type = "Helm";
- break;
- case 1:
- type = "Chest";
- break;
- case 2:
- type = "Pants";
- break;
- case 3:
- type = "Boots";
- break;
- }
- }
- tips = addToArray(tips, item.getRarity(stack).rarityName + " " + type);
- }
- if (isArmor)
- tips = addToArray(tips, "Armor Strength: " + ((ItemArmor) item).damageReduceAmount);
- if (item.getMaxDamage() > 0)
- tips = addToArray(tips, "Max Use: " + item.getMaxDamage());
- else if (!stack.getHasSubtypes())
- wrap = new ItemWrap(wrap.getName(), 0x8000);
- switch (item.getItemUseAction(stack)) {
- case block:
- tips = addToArray(tips, "Use: Blocks damage");
- break;
- case bow:
- tips = addToArray(tips, "Use: Pull Back");
- break;
- case drink:
- tips = addToArray(tips, "Drinkable");
- break;
- case eat:
- tips = addToArray(tips, "Edible");
- break;
- default:
- break;
- }
- if (item instanceof ItemFood)
- tips = addToArray(tips, "Feeds: " + ((ItemFood) item).getHealAmount() + " Half-bars");
- if (item.isPotionIngredient())
- tips = addToArray(tips, "Potion Ingredient");
- // if (item.getPotionEffect() != null && !item.getPotionEffect().isEmpty()) {
- // String[] effects = new String[] {};
- // Matcher m = pattern.matcher(item.getPotionEffect());
- // while (m.find())
- // effects = addToArray(effects, m.group());
- // for (String effect : effects)
- // tips = addToArray(tips, effect);
- // }
- if (values.containsKey(wrap))
- System.out.println("Contains same key... it never should...");
- values.put(wrap, tips);
- }
- }
Advertisement