net.minecraft.item.ItemArrow Java Examples
The following examples show how to use
net.minecraft.item.ItemArrow.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExtraInventory.java From ForgeHax with MIT License | 6 votes |
private static int getItemValue(ItemStack stack, boolean loopGuard) { Item item = stack.getItem(); if (stack.isEmpty()) { return 0; } else if (item instanceof ItemArmor || item instanceof ItemPickaxe || item instanceof ItemAxe || item instanceof ItemSword || item instanceof ItemFood || item instanceof ItemArrow || Items.TOTEM_OF_UNDYING.equals(item)) { return 100 * stack.getCount(); // very important } else if (item instanceof ItemShulkerBox) { return 5 + (loopGuard ? 0 : Utils.getShulkerContents(stack) .stream() .mapToInt(ExtraInventory::getItemValueSafe) .sum()); } else { return 5; } }
Example #2
Source File: ElectricBoogaloo.java From CommunityMod with GNU Lesser General Public License v2.1 | 5 votes |
@SubscribeEvent public static void itemToolTipEvent(ItemTooltipEvent event) { if (twosList == null || twosList.length < 1 || event.getToolTip().isEmpty()) return; boolean isPotion = event.getItemStack().getItem() instanceof ItemPotion || event.getItemStack().getItem() instanceof ItemArrow; for (int i = 0; i < event.getToolTip().size(); i++) { String toolTip = event.getToolTip().get(i); String lowerTip = toolTip.toLowerCase(); boolean relocateReset = false; if (lowerTip.endsWith("§r")) { lowerTip = lowerTip.substring(0, lowerTip.length() - 2); toolTip = toolTip.substring(0, toolTip.length() - 2); relocateReset = true; } for (String to : twosList) { String boogaloo = null; if (isPotion && TIMER_PATTERN.matcher(lowerTip).find()) { String potionName = lowerTip.substring(0, lowerTip.indexOf('(') - 1); if (potionName.endsWith(to)) { int index = toolTip.indexOf('(') - 1; String beforeTimer = toolTip.substring(0, index); String timer = toolTip.substring(index); boogaloo = I18n.format("tooltip.community_mod.electric", beforeTimer) + timer; } } if (lowerTip.endsWith(to)) { boogaloo = I18n.format("tooltip.community_mod.electric", toolTip); if (relocateReset) boogaloo += "§r"; } if (!Strings.isNullOrEmpty(boogaloo)) event.getToolTip().set(i, boogaloo); } } }