net.minecraft.client.item.TooltipContext Java Examples
The following examples show how to use
net.minecraft.client.item.TooltipContext.
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: PaperBagItem.java From the-hallow with MIT License | 6 votes |
@Override public void appendTooltip(ItemStack itemStack, World world, List<Text> list, TooltipContext tooltipContext) { String translatedTooltip = new TranslatableText("text.thehallow.paper_bag").asString(); String[] translatedTooltipWords = translatedTooltip.split(" "); StringBuilder tooltipBuilder = new StringBuilder(); for (int i = 1; i <= translatedTooltipWords.length; i++) { tooltipBuilder.append(translatedTooltipWords[i - 1]); if (i % 4 == 0) { list.add(new LiteralText(tooltipBuilder.toString()).formatted(Formatting.GRAY)); tooltipBuilder = new StringBuilder(); } else { tooltipBuilder.append(" "); } } super.appendTooltip(itemStack, world, list, tooltipContext); }
Example #2
Source File: ItemWrapper.java From Sandbox with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void appendTooltip(net.minecraft.item.ItemStack itemStack_1, @Nullable net.minecraft.world.World world_1, List<Text> list_1, TooltipContext tooltipContext_1) { List<org.sandboxpowered.sandbox.api.util.text.Text> tooltip = new LinkedList<>(); item.appendTooltipText( WrappingUtil.cast(itemStack_1, ItemStack.class), world_1 == null ? null : (World) world_1, tooltip, tooltipContext_1.isAdvanced() ); tooltip.forEach(text -> list_1.add(WrappingUtil.convert(text))); super.appendTooltip(itemStack_1, world_1, list_1, tooltipContext_1); }
Example #3
Source File: GlowstoneTorchBlock.java From Galacticraft-Rewoven with MIT License | 5 votes |
@Override @Environment(EnvType.CLIENT) public void buildTooltip(ItemStack itemStack, BlockView blockView, List<Text> list, TooltipContext tooltipContext) { if (Screen.hasShiftDown()) { list.add(new TranslatableText("tooltip.galacticraft-rewoven.glowstone_torch").setStyle(Style.EMPTY.withColor(Formatting.GRAY))); } else { list.add(new TranslatableText("tooltip.galacticraft-rewoven.press_shift").setStyle(Style.EMPTY.withColor(Formatting.GRAY))); } }
Example #4
Source File: GlowstoneWallTorchBlock.java From Galacticraft-Rewoven with MIT License | 5 votes |
@Override @Environment(EnvType.CLIENT) public void buildTooltip(ItemStack itemStack, BlockView blockView, List<Text> list, TooltipContext tooltipContext) { if (Screen.hasShiftDown()) { list.add(new TranslatableText("tooltip.galacticraft-rewoven.glowstone_torch").setStyle(Style.EMPTY.withColor(Formatting.GRAY))); } else { list.add(new TranslatableText("tooltip.galacticraft-rewoven.press_shift").setStyle(Style.EMPTY.withColor(Formatting.GRAY))); } }
Example #5
Source File: ItemWrapper.java From Sandbox with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void appendTooltip(net.minecraft.item.ItemStack itemStack_1, @Nullable net.minecraft.world.World world_1, List<Text> list_1, TooltipContext tooltipContext_1) { List<org.sandboxpowered.sandbox.api.util.text.Text> tooltip = new LinkedList<>(); item.appendTooltipText( WrappingUtil.cast(itemStack_1, ItemStack.class), world_1 == null ? null : (World) world_1, tooltip, tooltipContext_1.isAdvanced() ); tooltip.forEach(text -> list_1.add(WrappingUtil.convert(text))); super.appendTooltip(itemStack_1, world_1, list_1, tooltipContext_1); }
Example #6
Source File: ItemWrapper.java From Sandbox with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void appendTooltip(net.minecraft.item.ItemStack itemStack_1, @Nullable net.minecraft.world.World world_1, List<Text> list_1, TooltipContext tooltipContext_1) { List<org.sandboxpowered.sandbox.api.util.text.Text> tooltip = new LinkedList<>(); iItem.appendTooltipText( WrappingUtil.cast(itemStack_1, ItemStack.class), world_1 == null ? null : (World) world_1, tooltip, tooltipContext_1.isAdvanced() ); tooltip.forEach(text -> list_1.add(WrappingUtil.convert(text))); super.appendTooltip(itemStack_1, world_1, list_1, tooltipContext_1); }
Example #7
Source File: CompressorBlock.java From Galacticraft-Rewoven with MIT License | 5 votes |
@Override @Environment(EnvType.CLIENT) public final void buildTooltip(ItemStack itemStack_1, BlockView blockView_1, List<Text> list_1, TooltipContext tooltipContext_1) { if (Screen.hasShiftDown()) { list_1.add(new TranslatableText("tooltip.galacticraft-rewoven.compressor").setStyle(Style.EMPTY.withColor(Formatting.GRAY))); } else { list_1.add(new TranslatableText("tooltip.galacticraft-rewoven.press_shift").setStyle(Style.EMPTY.withColor(Formatting.GRAY))); } }
Example #8
Source File: BatteryItem.java From Galacticraft-Rewoven with MIT License | 5 votes |
@Override @Environment(EnvType.CLIENT) public void appendTooltip(ItemStack stack, World world, List<Text> lines, TooltipContext context) { int charge = stack.getOrCreateTag().getInt("Energy"); if (stack.getMaxDamage() - stack.getDamage() < 3334) { lines.add(new TranslatableText("tooltip.galacticraft-rewoven.energy-remaining", charge).setStyle(Style.EMPTY.withColor(Formatting.DARK_RED))); } else if (stack.getMaxDamage() - stack.getDamage() < 6667) { lines.add(new TranslatableText("tooltip.galacticraft-rewoven.energy-remaining", charge).setStyle(Style.EMPTY.withColor(Formatting.GOLD))); } else { lines.add(new TranslatableText("tooltip.galacticraft-rewoven.energy-remaining", charge).setStyle(Style.EMPTY.withColor(Formatting.GREEN))); } super.appendTooltip(stack, world, lines, context); }
Example #9
Source File: StandardWrenchItem.java From Galacticraft-Rewoven with MIT License | 5 votes |
@Override @Environment(EnvType.CLIENT) public void appendTooltip(ItemStack itemStack_1, World world_1, List<Text> list_1, TooltipContext tooltipContext_1) { if (Screen.hasShiftDown()) { list_1.add(new TranslatableText("tooltip.galacticraft-rewoven.standard_wrench").setStyle(Style.EMPTY.withColor(Formatting.GRAY))); } else { list_1.add(new TranslatableText("tooltip.galacticraft-rewoven.press_shift").setStyle(Style.EMPTY.withColor(Formatting.GRAY))); } }
Example #10
Source File: EnergyStorageModuleBlock.java From Galacticraft-Rewoven with MIT License | 4 votes |
@Override public Text machineInfo(ItemStack itemStack_1, BlockView blockView_1, TooltipContext tooltipContext_1) { return new TranslatableText("tooltip.galacticraft-rewoven.energy_storage_module").setStyle(Style.EMPTY.withColor(Formatting.GRAY)); }
Example #11
Source File: PumpkinRingItem.java From the-hallow with MIT License | 4 votes |
@Override public void appendTooltip(ItemStack itemStack, World world, List<Text> list, TooltipContext context) { list.add(new TranslatableText("text.thehallow.pumpkin_ring").formatted(Formatting.GRAY)); super.appendTooltip(itemStack, world, list, context); }
Example #12
Source File: GoldenCandyCornItem.java From the-hallow with MIT License | 4 votes |
@Override public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext ctx) { tooltip.add(new TranslatableText("text.thehallow.candycorn.0").formatted(Formatting.GOLD)); tooltip.add(new TranslatableText("text.thehallow.candycorn.1").formatted(Formatting.GOLD)); }
Example #13
Source File: OxygenTankItem.java From Galacticraft-Rewoven with MIT License | 4 votes |
@Override @Environment(EnvType.CLIENT) public void appendTooltip(ItemStack stack, World world, List<Text> lines, TooltipContext context) { lines.add(new TranslatableText("tooltip.galacticraft-rewoven.oxygen-remaining", getOxygenCount(stack) + "/" + this.maxOxygen)); super.appendTooltip(stack, world, lines, context); }
Example #14
Source File: CoalGeneratorBlock.java From Galacticraft-Rewoven with MIT License | 4 votes |
@Override public Text machineInfo(ItemStack itemStack_1, BlockView blockView_1, TooltipContext tooltipContext_1) { return new TranslatableText("tooltip.galacticraft-rewoven.coal_generator"); }
Example #15
Source File: ConfigurableElectricMachineBlock.java From Galacticraft-Rewoven with MIT License | 4 votes |
@Override @Environment(EnvType.CLIENT) public final void buildTooltip(ItemStack itemStack_1, BlockView blockView_1, List<Text> list_1, TooltipContext tooltipContext_1) { Text text = machineInfo(itemStack_1, blockView_1, tooltipContext_1); if (text != null) { List<Text> info = new ArrayList<>(); for (StringRenderable s : MinecraftClient.getInstance().textRenderer.wrapLines(text, 150)) { info.add(new LiteralText(s.getString()).setStyle(Style.EMPTY.withColor(Formatting.DARK_GRAY))); } if (!info.isEmpty()) { if (Screen.hasShiftDown()) { list_1.addAll(info); } else { list_1.add(new TranslatableText("tooltip.galacticraft-rewoven.press_shift").setStyle(Style.EMPTY.withColor(Formatting.DARK_GRAY))); } } } if (itemStack_1 != null && itemStack_1.getTag() != null && itemStack_1.getTag().contains("BlockEntityTag")) { list_1.add(new LiteralText("")); list_1.add(new TranslatableText("ui.galacticraft-rewoven.machine.current_energy", itemStack_1.getTag().getCompound("BlockEntityTag").getInt("Energy")).setStyle(Style.EMPTY.withColor(Formatting.AQUA))); list_1.add(new TranslatableText("ui.galacticraft-rewoven.tabs.security_config.owner", itemStack_1.getTag().getCompound("BlockEntityTag").getString("OwnerUsername")).setStyle(Style.EMPTY.withColor(Formatting.BLUE))); if (itemStack_1.getTag().getCompound("BlockEntityTag").getBoolean("Public")) { list_1.add(new TranslatableText("ui.galacticraft-rewoven.tabs.security_config_2").setStyle(Style.EMPTY .withColor(Formatting.GRAY)).append(new TranslatableText("ui.galacticraft-rewoven.tabs.security_config.public_2") .setStyle(Style.EMPTY.withColor(Formatting.GREEN)))); } else if (itemStack_1.getTag().getCompound("BlockEntityTag").getBoolean("Party")) { list_1.add(new TranslatableText("ui.galacticraft-rewoven.tabs.security_config_2").setStyle(Style.EMPTY .withColor(Formatting.GRAY)).append(new TranslatableText("ui.galacticraft-rewoven.tabs.security_config.space_race_2") .setStyle(Style.EMPTY.withColor(Formatting.DARK_GRAY)))); } else { list_1.add(new TranslatableText("ui.galacticraft-rewoven.tabs.security_config_2").setStyle(Style.EMPTY .withColor(Formatting.GRAY)).append(new TranslatableText("ui.galacticraft-rewoven.tabs.security_config.private_2") .setStyle(Style.EMPTY.withColor(Formatting.DARK_RED)))); } if (itemStack_1.getTag().getCompound("BlockEntityTag").getString("Redstone").equals("DISABLED")) { list_1.add(new TranslatableText("ui.galacticraft-rewoven.tabs.redstone_activation_config_2").setStyle(Style.EMPTY.withColor(Formatting.RED)).append(new TranslatableText("ui.galacticraft-rewoven.tabs.redstone_activation_config.ignore_2").setStyle(Style.EMPTY.withColor(Formatting.GRAY)))); } else if (itemStack_1.getTag().getCompound("BlockEntityTag").getString("Redstone").equals("OFF")) { list_1.add(new TranslatableText("ui.galacticraft-rewoven.tabs.redstone_activation_config_2").setStyle(Style.EMPTY.withColor(Formatting.RED)).append(new TranslatableText("ui.galacticraft-rewoven.tabs.redstone_activation_config.redstone_means_off_2").setStyle(Style.EMPTY.withColor(Formatting.DARK_RED)))); } else { list_1.add(new TranslatableText("ui.galacticraft-rewoven.tabs.redstone_activation_config_2").setStyle(Style.EMPTY.withColor(Formatting.RED)).append(new TranslatableText("ui.galacticraft-rewoven.tabs.redstone_activation_config.redstone_means_on_2").setStyle(Style.EMPTY.withColor(Formatting.DARK_RED)))); } } }
Example #16
Source File: RefineryBlock.java From Galacticraft-Rewoven with MIT License | 4 votes |
@Override public Text machineInfo(ItemStack itemStack_1, BlockView blockView_1, TooltipContext tooltipContext_1) { return new TranslatableText("tooltip.galacticraft-rewoven.refinery"); }
Example #17
Source File: ElectricCompressorBlock.java From Galacticraft-Rewoven with MIT License | 4 votes |
@Override public Text machineInfo(ItemStack itemStack_1, BlockView blockView_1, TooltipContext tooltipContext_1) { return new TranslatableText("tooltip.galacticraft-rewoven.electric_compressor").setStyle(Style.EMPTY.withColor(Formatting.GRAY)); }
Example #18
Source File: CircuitFabricatorBlock.java From Galacticraft-Rewoven with MIT License | 4 votes |
@Override public Text machineInfo(ItemStack itemStack_1, BlockView blockView_1, TooltipContext tooltipContext_1) { return new TranslatableText("tooltip.galacticraft-rewoven.circuit_fabricator"); }
Example #19
Source File: BasicSolarPanelBlock.java From Galacticraft-Rewoven with MIT License | 4 votes |
@Override public Text machineInfo(ItemStack itemStack_1, BlockView blockView_1, TooltipContext tooltipContext_1) { return new TranslatableText("tooltip.galacticraft-rewoven.basic_solar_panel"); }
Example #20
Source File: OxygenCollectorBlock.java From Galacticraft-Rewoven with MIT License | 4 votes |
@Override public Text machineInfo(ItemStack itemStack_1, BlockView blockView_1, TooltipContext tooltipContext_1) { return new TranslatableText("tooltip.galacticraft-rewoven.oxygen_collector"); }
Example #21
Source File: ConfigurableElectricMachineBlock.java From Galacticraft-Rewoven with MIT License | votes |
public abstract Text machineInfo(ItemStack itemStack_1, BlockView blockView_1, TooltipContext tooltipContext_1);