From e28c64a23999671a0323d78b2f5e3cf75ecb8777 Mon Sep 17 00:00:00 2001 From: geosk <32211101+geosskk@users.noreply.github.com> Date: Thu, 9 Nov 2023 02:26:31 -0800 Subject: [PATCH] [1.20] Fixes for the tooltips of Powah's items. (#114) * Fixed the string interpolation used for the localization in the power receive, extract, io, and generation tooltips. * Removed the extra blank line from the items tooltips. * Removed getEnergyInfo() from EnergyCellItem to show the tooltips for the Energy Cell items. * Fix the wrench item's tooltips to make the current mode text yellow. --- .../owmii/powah/block/reactor/ReactorBlock.java | 4 ++-- .../java/owmii/powah/item/BindingCardItem.java | 2 -- .../java/owmii/powah/item/EnergyCellItem.java | 5 ----- .../main/java/owmii/powah/item/WrenchItem.java | 15 +++++++++------ .../powah/lib/block/AbstractEnergyBlock.java | 7 +++---- .../powah/lib/block/AbstractGeneratorBlock.java | 4 ++-- .../java/owmii/powah/lib/item/EnergyItem.java | 1 - .../main/resources/assets/powah/lang/en_us.json | 7 ++++--- .../main/resources/assets/powah/lang/fr_fr.json | 7 ++++--- .../main/resources/assets/powah/lang/pt_br.json | 7 ++++--- .../main/resources/assets/powah/lang/ru_ru.json | 7 ++++--- .../main/resources/assets/powah/lang/zh_cn.json | 7 ++++--- .../main/resources/assets/powah/lang/zh_tw.json | 7 ++++--- 13 files changed, 40 insertions(+), 40 deletions(-) diff --git a/common/src/main/java/owmii/powah/block/reactor/ReactorBlock.java b/common/src/main/java/owmii/powah/block/reactor/ReactorBlock.java index 04463231..3f76b5cc 100644 --- a/common/src/main/java/owmii/powah/block/reactor/ReactorBlock.java +++ b/common/src/main/java/owmii/powah/block/reactor/ReactorBlock.java @@ -120,8 +120,8 @@ protected void createBlockStateDefinition(StateDefinition.Builder tooltip) { tooltip.add(Component.translatable("info.powah.generation.factor").withStyle(ChatFormatting.GRAY).append(Text.COLON) - .append(Component.literal(Util.numFormat(getConfig().getGeneration(this.variant))) - .append(Component.translatable("info.lollipop.fe.pet.tick")).withStyle(ChatFormatting.DARK_GRAY))); + .append(Component.translatable("info.lollipop.fe.pet.tick", Util.numFormat(getConfig().getGeneration(this.variant))) + .withStyle(ChatFormatting.DARK_GRAY))); } @Override diff --git a/common/src/main/java/owmii/powah/item/BindingCardItem.java b/common/src/main/java/owmii/powah/item/BindingCardItem.java index 8b4f0619..8110006f 100644 --- a/common/src/main/java/owmii/powah/item/BindingCardItem.java +++ b/common/src/main/java/owmii/powah/item/BindingCardItem.java @@ -83,11 +83,9 @@ public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List use(Level worldIn, Player playerIn, In if (playerIn.isShiftKeyDown()) { nextWrenchMode(stack); playerIn.displayClientMessage( - Component.translatable("info.powah.wrench.mode." + getWrenchMode(stack).name().toLowerCase(), ChatFormatting.YELLOW) - .withStyle(ChatFormatting.GRAY), + Component.translatable("info.powah.wrench.mode", + Component.translatable("info.powah.wrench.mode." + getWrenchMode(stack).name().toLowerCase()) + .withStyle(ChatFormatting.YELLOW)), true); return InteractionResultHolder.success(stack); } @@ -129,8 +130,9 @@ public InteractionResultHolder use(Level worldIn, Player playerIn, In @Override public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) { - tooltip.add(Component.translatable("info.powah.wrench.mode." + getWrenchMode(stack).name().toLowerCase(), ChatFormatting.YELLOW) - .withStyle(ChatFormatting.GRAY)); + tooltip.add(Component.translatable("info.powah.wrench.mode", + Component.translatable("info.powah.wrench.mode." + getWrenchMode(stack).name().toLowerCase()) + .withStyle(ChatFormatting.YELLOW))); } @Override @@ -138,8 +140,9 @@ public void inventoryTick(ItemStack stack, Level worldIn, Entity entityIn, int i if (entityIn instanceof Player) { Player player = (Player) entityIn; oneTimeInfo(player, stack, - Component.translatable("info.powah.wrench.mode." + getWrenchMode(stack).name().toLowerCase(), ChatFormatting.YELLOW) - .withStyle(ChatFormatting.GRAY)); + Component.translatable("info.powah.wrench.mode", + Component.translatable("info.powah.wrench.mode." + getWrenchMode(stack).name().toLowerCase()) + .withStyle(ChatFormatting.YELLOW))); } } diff --git a/common/src/main/java/owmii/powah/lib/block/AbstractEnergyBlock.java b/common/src/main/java/owmii/powah/lib/block/AbstractEnergyBlock.java index 955172a6..7a7e0cea 100644 --- a/common/src/main/java/owmii/powah/lib/block/AbstractEnergyBlock.java +++ b/common/src/main/java/owmii/powah/lib/block/AbstractEnergyBlock.java @@ -91,7 +91,6 @@ public void appendHoverText(ItemStack stack, @Nullable BlockGetter worldIn, List addEnergyInfo(stack, energy, tooltip); addEnergyTransferInfo(stack, energy, tooltip); additionalEnergyInfo(stack, energy, tooltip); - tooltip.add(Component.empty()); }); } @@ -109,16 +108,16 @@ public void addEnergyTransferInfo(ItemStack stack, Energy.Item storage, List 0) { if (ext == re) { tooltip.add(Component.translatable("info.lollipop.max.io").withStyle(ChatFormatting.GRAY).append(Text.COLON) - .append(Component.literal(Util.numFormat(ext)).append(Component.translatable("info.lollipop.fe.pet.tick")) + .append(Component.translatable("info.lollipop.fe.pet.tick", Util.numFormat(ext)) .withStyle(ChatFormatting.DARK_GRAY))); } else { if (ext > 0) tooltip.add(Component.translatable("info.lollipop.max.extract").withStyle(ChatFormatting.GRAY).append(Text.COLON) - .append(Component.literal(Util.numFormat(ext)).append(Component.translatable("info.lollipop.fe.pet.tick")) + .append(Component.translatable("info.lollipop.fe.pet.tick", Util.numFormat(ext)) .withStyle(ChatFormatting.DARK_GRAY))); if (re > 0) tooltip.add(Component.translatable("info.lollipop.max.receive").withStyle(ChatFormatting.GRAY).append(Text.COLON) - .append(Component.literal(Util.numFormat(re)).append(Component.translatable("info.lollipop.fe.pet.tick")) + .append(Component.translatable("info.lollipop.fe.pet.tick", Util.numFormat(re)) .withStyle(ChatFormatting.DARK_GRAY))); } } diff --git a/common/src/main/java/owmii/powah/lib/block/AbstractGeneratorBlock.java b/common/src/main/java/owmii/powah/lib/block/AbstractGeneratorBlock.java index 6c4c2fc1..0b911b41 100644 --- a/common/src/main/java/owmii/powah/lib/block/AbstractGeneratorBlock.java +++ b/common/src/main/java/owmii/powah/lib/block/AbstractGeneratorBlock.java @@ -24,8 +24,8 @@ public AbstractGeneratorBlock(Properties properties, Tier variant) { @Override public void additionalEnergyInfo(ItemStack stack, Energy.Item energy, List tooltip) { tooltip.add(Component.translatable("info.lollipop.generates").withStyle(ChatFormatting.GRAY).append(Text.COLON) - .append(Component.literal(Util.numFormat(getConfig().getGeneration(this.variant))) - .append(Component.translatable("info.lollipop.fe.pet.tick")).withStyle(ChatFormatting.DARK_GRAY))); + .append(Component.translatable("info.lollipop.fe.pet.tick", Util.numFormat(getConfig().getGeneration(this.variant))) + .withStyle(ChatFormatting.DARK_GRAY))); } @Override diff --git a/common/src/main/java/owmii/powah/lib/item/EnergyItem.java b/common/src/main/java/owmii/powah/lib/item/EnergyItem.java index 5e7ea310..ff1663a1 100644 --- a/common/src/main/java/owmii/powah/lib/item/EnergyItem.java +++ b/common/src/main/java/owmii/powah/lib/item/EnergyItem.java @@ -47,7 +47,6 @@ public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List