Java Code Examples for net.minecraft.item.ItemStack#getDisplayName()
The following examples show how to use
net.minecraft.item.ItemStack#getDisplayName() .
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: ItemNullifier.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
@Override public String getItemStackDisplayName(ItemStack stack) { String name = super.getItemStackDisplayName(stack); int slot = NBTUtils.getByte(stack, TAG_NAME_CONTAINER, TAG_NAME_SLOT_SELECTION) + 1; ItemStack selectedStack = getSelectedStack(stack); if (selectedStack.isEmpty() == false) { return name + " - " + slot + " / " + NUM_SLOTS + " - " + selectedStack.getDisplayName(); } else { return name + " - " + slot + " / " + NUM_SLOTS; } }
Example 2
Source File: OreDictionaryDumper.java From NEI-Integration with MIT License | 6 votes |
@Override public Iterable<String[]> dump(int mode) { List<String[]> list = new LinkedList<String[]>(); List<String> oreNames = Arrays.asList(OreDictionary.getOreNames()); Collections.sort(oreNames); for (String oreName : oreNames) { List<ItemStack> ores = OreDictionary.getOres(oreName); String displayName; for (ItemStack ore : ores) { if (ore.getItemDamage() == OreDictionary.WILDCARD_VALUE) { displayName = "(wildcard)"; } else { try { displayName = ore.getDisplayName(); } catch (Exception e) { displayName = "-"; } } list.add(new String[] { oreName, ore.toString(), Item.itemRegistry.getNameForObject(ore.getItem()), displayName, String.valueOf(ore.getItemDamage() == OreDictionary.WILDCARD_VALUE) }); } } return list; }
Example 3
Source File: JSHandler.java From OmniOcular with Apache License 2.0 | 5 votes |
public static String getDisplayName(String hashCode) { try { NBTTagCompound nc = NBTCache.get(Integer.valueOf(hashCode)); ItemStack is = ItemStack.loadItemStackFromNBT(nc); return is.getDisplayName(); } catch (Exception e) { return "__ERROR__"; } }
Example 4
Source File: ItemHandyBag.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
@Override public String getItemStackDisplayName(ItemStack stack) { ItemStack moduleStack = this.getSelectedModuleStack(stack, ModuleType.TYPE_MEMORY_CARD_ITEMS); if (moduleStack.isEmpty() == false && moduleStack.getTagCompound() != null) { String itemName = super.getItemStackDisplayName(stack); //I18n.format(this.getUnlocalizedName(stack) + ".name").trim(); String rst = TextFormatting.RESET.toString() + TextFormatting.WHITE.toString(); // If the currently selected module has been renamed, show that name if (moduleStack.hasDisplayName()) { String pre = TextFormatting.GREEN.toString() + TextFormatting.ITALIC.toString(); if (itemName.length() >= 14) { return EUStringUtils.getInitialsWithDots(itemName) + " " + pre + moduleStack.getDisplayName() + rst; } return itemName + " " + pre + moduleStack.getDisplayName() + rst; } return itemName; } return super.getItemStackDisplayName(stack); }
Example 5
Source File: ItemLivingManipulator.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
@Override public String getItemStackDisplayName(ItemStack stack) { String str = super.getItemStackDisplayName(stack); String preGreen = TextFormatting.GREEN.toString(); String preGreenIta = preGreen + TextFormatting.ITALIC.toString(); String rst = TextFormatting.RESET.toString() + TextFormatting.WHITE.toString(); ItemStack moduleStack = this.getSelectedModuleStack(stack, ModuleType.TYPE_MEMORY_CARD_MISC); if (moduleStack.isEmpty() == false) { if (str.length() >= 14) { str = EUStringUtils.getInitialsWithDots(str); } // If the currently selected module has been renamed, show that name if (moduleStack.hasDisplayName()) { str = str + " " + preGreenIta + moduleStack.getDisplayName() + rst; } else { str = str + " MC: " + preGreen + (UtilItemModular.getClampedModuleSelection(stack, ModuleType.TYPE_MEMORY_CARD_MISC) + 1) + rst; } int index = this.getCurrentIndex(stack); int count = this.getStoredEntityCount(stack); str = str + " E: " + preGreen + (index + 1) + "/" + count + rst; String entityName = this.getEntityName(stack, index, true); if (entityName != null) { str = str + " -> " + entityName; } } return str; }
Example 6
Source File: BuildersWandRenderer.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
private String getBlockTypeName(ItemBuildersWand wand, ItemStack stack, int index, boolean secondary) { if (index >= 0) { BlockInfo blockInfo = wand.getSelectedFixedBlockType(stack, secondary); if (blockInfo != null) { ItemStack blockStack = new ItemStack(blockInfo.block, 1, blockInfo.itemMeta); if (blockStack.isEmpty() == false && blockStack.getItem() != null && blockStack.getItem() != Items.AIR) { return TextFormatting.GREEN.toString() + blockStack.getDisplayName(); } } return TextFormatting.RED.toString() + "N/A"; } else { if (index == ItemBuildersWand.BLOCK_TYPE_TARGETED) { return TextFormatting.AQUA.toString() + I18n.format("enderutilities.tooltip.item.blocktype.targeted"); } else { return TextFormatting.AQUA.toString() + I18n.format("enderutilities.tooltip.item.blocktype.adjacent"); } } }
Example 7
Source File: ItemInventorySwapper.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
@Override public String getItemStackDisplayName(ItemStack stack) { String itemName = super.getItemStackDisplayName(stack); String preGreenIta = TextFormatting.GREEN.toString() + TextFormatting.ITALIC.toString(); String preGreen = TextFormatting.GREEN.toString(); String rst = TextFormatting.RESET.toString() + TextFormatting.WHITE.toString(); int slotNum = UtilItemModular.getStoredModuleSelection(stack, ModuleType.TYPE_MEMORY_CARD_ITEMS); ItemStack moduleStack = UtilItemModular.getModuleStackBySlotNumber(stack, slotNum, ModuleType.TYPE_MEMORY_CARD_ITEMS); if (moduleStack.isEmpty() == false && moduleStack.getTagCompound() != null) { // If the currently selected module has been renamed, show that name if (moduleStack.hasDisplayName()) { if (itemName.length() >= 14) { itemName = EUStringUtils.getInitialsWithDots(itemName) + " " + preGreenIta + moduleStack.getDisplayName() + rst; } else { itemName = itemName + " " + preGreenIta + moduleStack.getDisplayName() + rst; } } //return itemName + " " + pre + (NBTUtils.getByte(stack, TAG_NAME_CONTAINER, TAG_NAME_PRESET_SELECTION) + 1) + rst; } // Module not renamed, show the module index instead itemName = itemName + " MC: " + preGreen + (slotNum + 1) + rst; byte selected = NBTUtils.getByte(stack, TAG_NAME_CONTAINER, TAG_NAME_PRESET_SELECTION); itemName = itemName + " P: " + preGreen + (selected + 1) + rst; return itemName; }
Example 8
Source File: TileEntityPortalPanel.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
private String getTargetName(int targetId) { if (targetId >= 0 && targetId <= 7) { ItemStack stack = this.itemHandlerBase.getStackInSlot(targetId); if (stack.isEmpty() == false) { return stack.getDisplayName(); } } return EUStringUtils.EMPTY; }
Example 9
Source File: SensorHandler.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
public List<String> getUpgradeInfo(){ List<String> text = new ArrayList<String>(); text.add(EnumChatFormatting.GRAY + "The following combinations of upgrades are used in sensors to work:"); for(String sensorPath : sensorPaths) { ItemStack[] requiredStacks = getRequiredStacksFromText(sensorPath.split("/")[0]); String upgradeTitle = ""; for(ItemStack stack : requiredStacks) { upgradeTitle = upgradeTitle + stack.getDisplayName() + " + "; } upgradeTitle = EnumChatFormatting.BLACK + "-" + upgradeTitle.substring(0, upgradeTitle.length() - 3).replace("Machine Upgrade: ", ""); if(!text.contains(upgradeTitle)) text.add(upgradeTitle); } return text; }
Example 10
Source File: GuiEngineeringTable.java From Cyberware with MIT License | 5 votes |
private String name() { ContainerEngineeringTable table = ((ContainerEngineeringTable) this.inventorySlots); if (table.componentBox instanceof Integer) { ItemStack stack = table.playerInv.mainInventory[(Integer) table.componentBox]; if (stack != null) { return stack.getDisplayName(); } } return ""; }
Example 11
Source File: ContainerBackpack.java From WearableBackpacks with MIT License | 5 votes |
public ContainerBackpack(EntityPlayer player, IBackpack backpack) { this.player = player; this.backpack = backpack; this.data = ((BackpackDataItems)backpack.getData()); size = data.getSize(); items = data.getItems(player.world, player); ItemStack stack = backpack.getStack(); title = (stack.hasDisplayName() ? stack.getDisplayName() : "container.wearablebackpacks.backpack"); titleLocalized = stack.hasDisplayName(); setupSlots(); }
Example 12
Source File: ItemEnderBag.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void addTooltipLines(ItemStack stack, EntityPlayer player, List<String> list, boolean verbose) { TargetData target = TargetData.getTargetFromSelectedModule(stack, ModuleType.TYPE_LINKCRYSTAL); if (target != null) { if ("minecraft:ender_chest".equals(target.blockName)) { ItemStack targetStack = new ItemStack(Block.getBlockFromName(target.blockName), 1, target.blockMeta & 0xF); String targetName = (targetStack.isEmpty() == false ? targetStack.getDisplayName() : ""); String textPre = TextFormatting.DARK_GREEN.toString(); String rst = TextFormatting.RESET.toString() + TextFormatting.GRAY.toString(); list.add(I18n.format("enderutilities.tooltip.item.target") + ": " + textPre + targetName + rst); // Ender Capacitor charge, if one has been installed ItemStack capacitorStack = this.getSelectedModuleStack(stack, ModuleType.TYPE_ENDERCAPACITOR); if (capacitorStack.isEmpty() == false && capacitorStack.getItem() instanceof ItemEnderCapacitor) { ((ItemEnderCapacitor) capacitorStack.getItem()).addTooltipLines(capacitorStack, player, list, verbose); } return; } } super.addTooltipLines(stack, player, list, verbose); }
Example 13
Source File: EditBlockListScreen.java From ForgeWurst with GNU General Public License v3.0 | 5 votes |
private String renderIconAndGetName(ItemStack stack, int y) { if(WItem.isNullOrEmpty(stack)) { GL11.glPushMatrix(); GL11.glTranslated(52, y, 0); GL11.glScaled(0.75, 0.75, 0.75); RenderHelper.enableGUIStandardItemLighting(); mc.getRenderItem().renderItemAndEffectIntoGUI( new ItemStack(Blocks.GRASS), 0, 0); RenderHelper.disableStandardItemLighting(); GL11.glPopMatrix(); GL11.glDisable(GL11.GL_DEPTH_TEST); FontRenderer fr = WMinecraft.getFontRenderer(); fr.drawString("?", 55, y + 2, 0xf0f0f0, true); GL11.glEnable(GL11.GL_DEPTH_TEST); return ChatFormatting.ITALIC + "unknown block" + ChatFormatting.RESET; }else { GL11.glPushMatrix(); GL11.glTranslated(52, y, 0); GL11.glScaled(0.75, 0.75, 0.75); RenderHelper.enableGUIStandardItemLighting(); mc.getRenderItem().renderItemAndEffectIntoGUI(stack, 0, 0); RenderHelper.disableStandardItemLighting(); GL11.glPopMatrix(); return stack.getDisplayName(); } }
Example 14
Source File: ItemStackMetadataBuilder.java From OpenPeripheral with MIT License | 5 votes |
private static String getNameForItemStack(ItemStack is) { try { return is.getDisplayName(); } catch (Exception e) {} try { return is.getUnlocalizedName(); } catch (Exception e2) {} return "unknown"; }
Example 15
Source File: EntityPlayerSPHook.java From SkyblockAddons with MIT License | 4 votes |
public static EntityItem dropOneItemConfirmation(ReturnValue<?> returnValue) { SkyblockAddons main = SkyblockAddons.getInstance(); Minecraft mc = Minecraft.getMinecraft(); ItemStack heldItemStack = mc.thePlayer.getHeldItem(); if ((main.getUtils().isOnSkyblock() || main.getPlayerListener().aboutToJoinSkyblockServer())) { if (main.getConfigValues().isEnabled(Feature.LOCK_SLOTS) && !main.getUtils().isInDungeon()) { int slot = mc.thePlayer.inventory.currentItem + 36; if (main.getConfigValues().getLockedSlots().contains(slot) && (slot >= 9 || mc.thePlayer.openContainer instanceof ContainerPlayer && slot >= 5)) { main.getUtils().playLoudSound("note.bass", 0.5); SkyblockAddons.getInstance().getUtils().sendMessage(main.getConfigValues().getRestrictedColor(Feature.DROP_CONFIRMATION) + Message.MESSAGE_SLOT_LOCKED.getMessage()); returnValue.cancel(); return null; } if (System.currentTimeMillis() - MinecraftHook.getLastLockedSlotItemChange() < 200) { main.getUtils().playLoudSound("note.bass", 0.5); SkyblockAddons.getInstance().getUtils().sendMessage(main.getConfigValues().getRestrictedColor(Feature.DROP_CONFIRMATION) + Message.MESSAGE_SWITCHED_SLOTS.getMessage()); returnValue.cancel(); return null; } } if (heldItemStack != null && main.getConfigValues().isEnabled(Feature.STOP_DROPPING_SELLING_RARE_ITEMS) && !main.getUtils().isInDungeon()) { if (!main.getUtils().getItemDropChecker().canDropItem(heldItemStack, true)) { main.getUtils().sendMessage(main.getConfigValues().getRestrictedColor(Feature.STOP_DROPPING_SELLING_RARE_ITEMS) + Message.MESSAGE_CANCELLED_DROPPING.getMessage()); returnValue.cancel(); return null; } if (System.currentTimeMillis() - MinecraftHook.getLastLockedSlotItemChange() < 200) { main.getUtils().playLoudSound("note.bass", 0.5); SkyblockAddons.getInstance().getUtils().sendMessage(main.getConfigValues().getRestrictedColor(Feature.DROP_CONFIRMATION) + Message.MESSAGE_SWITCHED_SLOTS.getMessage()); returnValue.cancel(); return null; } } } if (heldItemStack != null && main.getConfigValues().isEnabled(Feature.DROP_CONFIRMATION) && !main.getUtils().isInDungeon() && (main.getUtils().isOnSkyblock() || main.getPlayerListener().aboutToJoinSkyblockServer() || main.getConfigValues().isEnabled(Feature.DOUBLE_DROP_IN_OTHER_GAMES))) { lastDrop = Minecraft.getSystemTime(); String heldItemName = heldItemStack.hasDisplayName() ? heldItemStack.getDisplayName() : heldItemStack.getUnlocalizedName(); if (lastItemName == null || !lastItemName.equals(heldItemName) || Minecraft.getSystemTime() - lastDrop >= 3000L) { SkyblockAddons.getInstance().getUtils().sendMessage(main.getConfigValues().getRestrictedColor(Feature.DROP_CONFIRMATION) + Message.MESSAGE_DROP_CONFIRMATION.getMessage()); lastItemName = heldItemName; returnValue.cancel(); } } return null; }
Example 16
Source File: ItemHandyBag.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void addTooltipLines(ItemStack containerStack, EntityPlayer player, List<String> list, boolean verbose) { if (containerStack.getTagCompound() == null) { return; } String preGreen = TextFormatting.GREEN.toString(); String preRed = TextFormatting.RED.toString(); String preWhite = TextFormatting.WHITE.toString(); String rst = TextFormatting.RESET.toString() + TextFormatting.GRAY.toString(); String strPickupMode = I18n.format("enderutilities.tooltip.item.pickupmode" + (verbose ? "" : ".short")) + ": "; String strRestockMode = I18n.format("enderutilities.tooltip.item.restockmode" + (verbose ? "" : ".short")) + ": "; PickupMode pickupMode = PickupMode.fromStack(containerStack); if (pickupMode == PickupMode.NONE) strPickupMode += preRed; else if (pickupMode == PickupMode.MATCHING) strPickupMode += TextFormatting.YELLOW.toString(); else if (pickupMode == PickupMode.ALL) strPickupMode += preGreen; strPickupMode += pickupMode.getDisplayName() + rst; RestockMode restockMode = RestockMode.fromStack(containerStack); if (restockMode == RestockMode.DISABLED) strRestockMode += preRed; else if (restockMode == RestockMode.ALL) strRestockMode += preGreen; else strRestockMode += TextFormatting.YELLOW.toString(); strRestockMode += restockMode.getDisplayName() + rst; if (verbose) { list.add(strPickupMode); list.add(strRestockMode); } else { list.add(strPickupMode + " / " + strRestockMode); } String str; if (bagIsOpenable(containerStack)) { str = I18n.format("enderutilities.tooltip.item.enabled") + ": " + preGreen + I18n.format("enderutilities.tooltip.item.yes"); } else { str = I18n.format("enderutilities.tooltip.item.enabled") + ": " + preRed + I18n.format("enderutilities.tooltip.item.no"); } list.add(str); int installed = this.getInstalledModuleCount(containerStack, ModuleType.TYPE_MEMORY_CARD_ITEMS); if (installed > 0) { int slotNum = UtilItemModular.getStoredModuleSelection(containerStack, ModuleType.TYPE_MEMORY_CARD_ITEMS); String preBlue = TextFormatting.BLUE.toString(); String preWhiteIta = preWhite + TextFormatting.ITALIC.toString(); String strShort = I18n.format("enderutilities.tooltip.item.selectedmemorycard.short"); ItemStack moduleStack = this.getSelectedModuleStack(containerStack, ModuleType.TYPE_MEMORY_CARD_ITEMS); int max = this.getMaxModules(containerStack, ModuleType.TYPE_MEMORY_CARD_ITEMS); if (moduleStack.isEmpty() == false && moduleStack.getItem() == EnderUtilitiesItems.ENDER_PART) { String dName = (moduleStack.hasDisplayName() ? preWhiteIta + moduleStack.getDisplayName() + rst + " " : ""); list.add(String.format("%s %s(%s%d%s / %s%d%s)", strShort, dName, preBlue, slotNum + 1, rst, preBlue, max, rst)); ((ItemEnderPart) moduleStack.getItem()).addTooltipLines(moduleStack, player, list, false); return; } else { String strNo = I18n.format("enderutilities.tooltip.item.selectedmemorycard.notinstalled"); list.add(String.format("%s %s (%s%d%s / %s%d%s)", strShort, strNo, preBlue, slotNum + 1, rst, preBlue, max, rst)); } } else { list.add(I18n.format("enderutilities.tooltip.item.nomemorycards")); } }
Example 17
Source File: WidgetMaterialListEntry.java From litematica with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void postRenderHovered(int mouseX, int mouseY, boolean isActiveGui, int hoveredWidgetId) { if (this.entry != null) { GlStateManager.pushMatrix(); //GlStateManager.translate(0, 0, 200); String header1 = GuiBase.TXT_BOLD + StringUtils.translate(HEADERS[0]); String header2 = GuiBase.TXT_BOLD + StringUtils.translate(HEADERS[1]); String header3 = GuiBase.TXT_BOLD + StringUtils.translate(HEADERS[2]); ItemStack stack = this.entry.getStack(); String stackName = stack.getDisplayName(); long multiplier = this.materialList.getMultiplier(); long total = this.entry.getCountTotal() * multiplier; long missing = this.materialList.getMultipliedMissingCount(this.entry); String strCountTotal = this.getFormattedCountString(total, stack.getMaxStackSize()); String strCountMissing = this.getFormattedCountString(missing, stack.getMaxStackSize()); int w1 = Math.max(this.getStringWidth(header1) , Math.max(this.getStringWidth(header2) , this.getStringWidth(header3))); int w2 = Math.max(this.getStringWidth(stackName) + 20, Math.max(this.getStringWidth(strCountTotal), this.getStringWidth(strCountMissing))); int totalWidth = w1 + w2 + 60; int x = mouseX + 10; int y = mouseY - 10; if (x + totalWidth - 20 >= this.getWidth()) { x -= totalWidth + 20; } int x1 = x + 10; int x2 = x1 + w1 + 20; int y1 = y + 6; int z = this.getZLevel() + 1; RenderUtils.drawOutlinedBox(x, y, totalWidth, 60, 0xFF000000, GuiBase.COLOR_HORIZONTAL_BAR, z); RenderUtils.drawRect(x2, y1, 16, 16, 0x20FFFFFF, z); // light background for the item y += 10; GlStateManager.translate(0f, 0f, z + 0.1f); this.drawString(x1 , y, 0xFFFFFFFF, header1); this.drawString(x2 + 20, y, 0xFFFFFFFF, stackName); y += 16; this.drawString(x1, y, 0xFFFFFFFF, header2); this.drawString(x2, y, 0xFFFFFFFF, strCountTotal); y += 16; this.drawString(x1, y, 0xFFFFFFFF, header3); this.drawString(x2, y, 0xFFFFFFFF, strCountMissing); GlStateManager.disableLighting(); RenderUtils.enableGuiItemLighting(); float origZ = this.mc.getRenderItem().zLevel; this.mc.getRenderItem().zLevel = z; this.mc.getRenderItem().renderItemAndEffectIntoGUI(this.mc.player, stack, x2, y1); //mc.getRenderItem().renderItemOverlayIntoGUI(mc.fontRenderer, stack, x1, y, null); this.mc.getRenderItem().zLevel = origZ; //GlStateManager.disableBlend(); RenderUtils.disableItemLighting(); GlStateManager.popMatrix(); } }
Example 18
Source File: ItemPortalScaler.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void addTooltipLines(ItemStack stack, EntityPlayer player, List<String> list, boolean verbose) { if (stack.getTagCompound() == null) { list.add(I18n.format("enderutilities.tooltip.item.usetoolworkstation")); return; } ItemStack memoryCardStack = this.getSelectedModuleStack(stack, ModuleType.TYPE_MEMORY_CARD_MISC); String preBlue = TextFormatting.BLUE.toString(); String preWhiteIta = TextFormatting.WHITE.toString() + TextFormatting.ITALIC.toString(); String rst = TextFormatting.RESET.toString() + TextFormatting.GRAY.toString(); // Memory Cards installed if (memoryCardStack.isEmpty() == false) { if (this.memoryCardHasScaleFactor(memoryCardStack)) { NBTTagCompound tag = memoryCardStack.getTagCompound().getCompoundTag("PortalScaler"); byte x = tag.getByte("scaleX"); byte y = tag.getByte("scaleY"); byte z = tag.getByte("scaleZ"); String sx = x < 0 ? "1/" + (-x) : String.valueOf(x); String sy = y < 0 ? "1/" + (-y) : String.valueOf(y); String sz = z < 0 ? "1/" + (-z) : String.valueOf(z); list.add(String.format("x: %s%s%s y: %s%s%s z: %s%s%s", preBlue, sx, rst, preBlue, sy, rst, preBlue, sz, rst)); } else { list.add(I18n.format("enderutilities.tooltip.item.nodata")); } if (verbose) { int num = UtilItemModular.getInstalledModuleCount(stack, ModuleType.TYPE_MEMORY_CARD_MISC); int sel = UtilItemModular.getClampedModuleSelection(stack, ModuleType.TYPE_MEMORY_CARD_MISC) + 1; String dName = (memoryCardStack.hasDisplayName() ? preWhiteIta + memoryCardStack.getDisplayName() + rst + " " : ""); list.add(I18n.format("enderutilities.tooltip.item.selectedmemorycard.short") + String.format(" %s(%s%d%s / %s%d%s)", dName, preBlue, sel, rst, preBlue, num, rst)); } } else { list.add(I18n.format("enderutilities.tooltip.item.nomemorycards")); } if (verbose) { // Ender Capacitor charge, if one has been installed ItemStack capacitorStack = this.getSelectedModuleStack(stack, ModuleType.TYPE_ENDERCAPACITOR); if (capacitorStack.isEmpty() == false && capacitorStack.getItem() instanceof ItemEnderCapacitor) { ((ItemEnderCapacitor) capacitorStack.getItem()).addTooltipLines(capacitorStack, player, list, verbose); } } }
Example 19
Source File: ItemRuler.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void addTooltipLines(ItemStack rulerStack, EntityPlayer player, List<String> list, boolean verbose) { if (rulerStack.getTagCompound() == null) { list.add(I18n.format("enderutilities.tooltip.item.usetoolworkstation")); return; } String preDGreen = TextFormatting.DARK_GREEN.toString(); String preGreen = TextFormatting.GREEN.toString(); String preRed = TextFormatting.RED.toString(); String preBlue = TextFormatting.BLUE.toString(); String preWhite = TextFormatting.WHITE.toString(); String rst = TextFormatting.RESET.toString() + TextFormatting.GRAY.toString(); String strYes = preGreen + I18n.format("enderutilities.tooltip.item.yes") + rst; String strNo = preRed + I18n.format("enderutilities.tooltip.item.no") + rst; String str; int selected = this.getLocationSelection(rulerStack); BlockPosEU posStart = this.getPosition(rulerStack, selected, POS_START); BlockPosEU posEnd = this.getPosition(rulerStack, selected, POS_END); if (verbose == false) { if (posStart != null && posEnd != null) { list.add(String.format("x: %s%d%s y: %s%d%s z: %s%d%s ... x: %s%d%s y: %s%d%s z: %s%d%s", preBlue, posStart.getX(), rst, preBlue, posStart.getY(), rst, preBlue, posStart.getZ(), rst, preBlue, posEnd.getX(), rst, preBlue, posEnd.getY(), rst, preBlue, posEnd.getZ(), rst)); } return; } if (posStart != null) { str = I18n.format("enderutilities.tooltip.item.start"); list.add(str + String.format(": x: %s%d%s, y: %s%d%s, z: %s%d%s", preBlue, posStart.getX(), rst, preBlue, posStart.getY(), rst, preBlue, posStart.getZ(), rst)); } if (posEnd != null) { str = I18n.format("enderutilities.tooltip.item.end"); list.add(str + String.format(": x: %s%d%s, y: %s%d%s, z: %s%d%s", preBlue, posEnd.getX(), rst, preBlue, posEnd.getY(), rst, preBlue, posEnd.getZ(), rst)); } str = I18n.format("enderutilities.tooltip.item.mode") + ": "; if (this.getDistanceMode(rulerStack) == DISTANCE_MODE_DIMENSIONS) { list.add(str + preDGreen + I18n.format("enderutilities.tooltip.item.ruler.dimensions") + rst); } else { list.add(str + preDGreen + I18n.format("enderutilities.tooltip.item.ruler.difference") + rst); } str = I18n.format("enderutilities.tooltip.item.rendercurrentwithall"); list.add(str + ": " + (this.getAlwaysRenderLocation(rulerStack, selected) ? strYes : strNo)); str = I18n.format("enderutilities.tooltip.item.renderall"); list.add(str + ": " + (this.getRenderAllLocations(rulerStack) ? strYes : strNo)); str = I18n.format("enderutilities.tooltip.item.renderwhenunselected"); list.add(str + ": " + (this.getRenderWhenUnselected(rulerStack) ? strYes : strNo)); int count = this.getLocationCount(rulerStack); str = I18n.format("enderutilities.tooltip.item.selected") + ": "; list.add(str + preBlue + (selected + 1) + rst + " / " + preBlue + count + rst); int installed = this.getInstalledModuleCount(rulerStack, ModuleType.TYPE_MEMORY_CARD_MISC); if (installed > 0) { int slotNum = UtilItemModular.getClampedModuleSelection(rulerStack, ModuleType.TYPE_MEMORY_CARD_MISC); int max = this.getMaxModules(rulerStack, ModuleType.TYPE_MEMORY_CARD_MISC); String preWhiteIta = preWhite + TextFormatting.ITALIC.toString(); String strShort = I18n.format("enderutilities.tooltip.item.selectedmemorycard.short"); ItemStack moduleStack = this.getSelectedModuleStack(rulerStack, ModuleType.TYPE_MEMORY_CARD_MISC); if (moduleStack.isEmpty() == false && moduleStack.getItem() == EnderUtilitiesItems.ENDER_PART) { String dName = (moduleStack.hasDisplayName() ? preWhiteIta + moduleStack.getDisplayName() + rst + " " : ""); list.add(String.format("%s %s(%s%d%s / %s%d%s)", strShort, dName, preBlue, slotNum + 1, rst, preBlue, max, rst)); } else { String strNot = I18n.format("enderutilities.tooltip.item.selectedmemorycard.notinstalled"); list.add(String.format("%s %s (%s%d%s / %s%d%s)", strShort, strNot, preBlue, slotNum + 1, rst, preBlue, max, rst)); } } }
Example 20
Source File: ItemLivingManipulator.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void addTooltipLines(ItemStack stack, EntityPlayer player, List<String> list, boolean verbose) { if (stack.getTagCompound() == null) { list.add(I18n.format("enderutilities.tooltip.item.usetoolworkstation")); return; } ItemStack memoryCardStack = this.getSelectedModuleStack(stack, ModuleType.TYPE_MEMORY_CARD_MISC); String preDGreen = TextFormatting.DARK_GREEN.toString(); String preBlue = TextFormatting.BLUE.toString(); String preWhiteIta = TextFormatting.WHITE.toString() + TextFormatting.ITALIC.toString(); String rst = TextFormatting.RESET.toString() + TextFormatting.GRAY.toString(); list.add(I18n.format("enderutilities.tooltip.item.mode") + ": " + preDGreen + Mode.getMode(stack).getDisplayName() + rst); if (verbose) { // Item supports Jailer modules, show if one is installed if (this.getMaxModules(stack, ModuleType.TYPE_MOBPERSISTENCE) > 0) { String s; if (this.getInstalledModuleCount(stack, ModuleType.TYPE_MOBPERSISTENCE) > 0) { s = I18n.format("enderutilities.tooltip.item.jailer") + ": " + TextFormatting.GREEN + I18n.format("enderutilities.tooltip.item.yes") + rst; } else { s = I18n.format("enderutilities.tooltip.item.jailer") + ": " + TextFormatting.RED + I18n.format("enderutilities.tooltip.item.no") + rst; } list.add(s); } } // Memory Cards installed if (memoryCardStack.isEmpty() == false) { if (verbose) { int num = UtilItemModular.getInstalledModuleCount(stack, ModuleType.TYPE_MEMORY_CARD_MISC); int sel = UtilItemModular.getClampedModuleSelection(stack, ModuleType.TYPE_MEMORY_CARD_MISC) + 1; String dName = (memoryCardStack.hasDisplayName() ? preWhiteIta + memoryCardStack.getDisplayName() + rst + " " : ""); list.add(I18n.format("enderutilities.tooltip.item.selectedmemorycard.short") + String.format(" %s(%s%d%s / %s%d%s)", dName, preBlue, sel, rst, preBlue, num, rst)); NBTTagList tagList = NBTUtils.getTagList(memoryCardStack, WRAPPER_TAG_NAME, "Entities", Constants.NBT.TAG_COMPOUND, false); if (tagList == null) { return; } int current = this.getCurrentIndex(stack); for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound tag = tagList.getCompoundTagAt(i); if (tag != null) { String name = this.getNameForEntityFromTag(tag, false); name = (i == current) ? "=> " + name : " " + name; list.add(name); } } } } else { list.add(I18n.format("enderutilities.tooltip.item.nomemorycards")); } }