From 1f88d24ddd5ad5102bad9fdef43fd8757a47abde Mon Sep 17 00:00:00 2001 From: Leronus Date: Fri, 9 Aug 2024 15:57:18 +0200 Subject: [PATCH] Updated tooltips --- .../leronus/mores/item/custom/ModAxeItem.java | 14 ++++++------ .../mores/item/custom/ModBattleAxeItem.java | 14 +++++------- .../leronus/mores/item/custom/ModHoeItem.java | 14 ++++++------ .../mores/item/custom/ModPickaxeItem.java | 14 ++++++------ .../mores/item/custom/ModShovelItem.java | 14 ++++++------ .../mores/item/custom/ModSwordItem.java | 22 +++++++++---------- 6 files changed, 44 insertions(+), 48 deletions(-) diff --git a/src/main/java/mod/leronus/mores/item/custom/ModAxeItem.java b/src/main/java/mod/leronus/mores/item/custom/ModAxeItem.java index e78a251..eaf4445 100644 --- a/src/main/java/mod/leronus/mores/item/custom/ModAxeItem.java +++ b/src/main/java/mod/leronus/mores/item/custom/ModAxeItem.java @@ -6,10 +6,7 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.item.AxeItem; -import net.minecraft.item.ItemStack; -import net.minecraft.item.MiningToolItem; -import net.minecraft.item.ToolMaterial; +import net.minecraft.item.*; import net.minecraft.text.Text; import net.minecraft.util.Formatting; import net.minecraft.world.World; @@ -39,9 +36,12 @@ public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attack @Override public void appendTooltip(ItemStack stack, TooltipContext context, List tooltip, TooltipType type) { if (stack.getItem() instanceof MiningToolItem item) { - if (item.getMaterial() == ModToolMaterials.RUBY){ - tooltip.add(Text.literal("")); - tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.auto_smelt").formatted(Formatting.DARK_RED))); + tooltip.add(Text.literal("")); + if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.ONYX) { + tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.wither_effect").formatted(Formatting.DARK_GRAY))); + } + if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.RUBY) { + tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.burn_effect").formatted(Formatting.DARK_RED))); } tooltip.add(Text.literal("")); // tooltip.add(Text.translatable("mores.harvest_level").formatted(Formatting.GRAY).append(Text.translatable(String.valueOf(item.getMaterial().getMiningLevel())).formatted(Formatting.GOLD))); diff --git a/src/main/java/mod/leronus/mores/item/custom/ModBattleAxeItem.java b/src/main/java/mod/leronus/mores/item/custom/ModBattleAxeItem.java index b0d1d4d..a7f9888 100644 --- a/src/main/java/mod/leronus/mores/item/custom/ModBattleAxeItem.java +++ b/src/main/java/mod/leronus/mores/item/custom/ModBattleAxeItem.java @@ -1,14 +1,12 @@ package mod.leronus.mores.item.custom; import mod.leronus.mores.item.ModItems; +import mod.leronus.mores.item.ModToolMaterials; import net.minecraft.item.tooltip.TooltipType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.SwordItem; -import net.minecraft.item.ToolMaterial; +import net.minecraft.item.*; import net.minecraft.text.Text; import net.minecraft.util.Formatting; @@ -43,14 +41,14 @@ public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attack public void appendTooltip(ItemStack stack, TooltipContext context, List tooltip, TooltipType type) { if (stack.getItem() instanceof ModBattleAxeItem){ tooltip.add(Text.literal("")); - if (stack.getItem() == ModItems.ONYX_BATTLEAXE) { + if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.ONYX) { tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.wither_effect").formatted(Formatting.DARK_GRAY))); } + if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.RUBY) { + tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.burn_effect").formatted(Formatting.DARK_RED))); + } tooltip.add(Text.literal("")); tooltip.add(Text.translatable("mores.durability").formatted(Formatting.GRAY).append(Text.translatable(String.valueOf(((ModBattleAxeItem) stack.getItem()).getMaterial().getDurability())).formatted(Formatting.LIGHT_PURPLE))); - if (stack.getItem() == ModItems.RUBY_SWORD || stack.getItem() == ModItems.RUBY_MACE || stack.getItem() == ModItems.RUBY_BATTLEAXE || stack.getItem() == ModItems.RUBY_DAGGER) { - tooltip.add(Text.translatable(Formatting.GRAY + "mores.bonus" + Formatting.RED + "Burn Effect")); - } } } } diff --git a/src/main/java/mod/leronus/mores/item/custom/ModHoeItem.java b/src/main/java/mod/leronus/mores/item/custom/ModHoeItem.java index d8a82a0..48bccb2 100644 --- a/src/main/java/mod/leronus/mores/item/custom/ModHoeItem.java +++ b/src/main/java/mod/leronus/mores/item/custom/ModHoeItem.java @@ -6,10 +6,7 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.item.HoeItem; -import net.minecraft.item.ItemStack; -import net.minecraft.item.MiningToolItem; -import net.minecraft.item.ToolMaterial; +import net.minecraft.item.*; import net.minecraft.text.Text; import net.minecraft.util.Formatting; @@ -36,9 +33,12 @@ public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attack @Override public void appendTooltip(ItemStack stack, TooltipContext context, List tooltip, TooltipType type) { if (stack.getItem() instanceof MiningToolItem item) { - if (item.getMaterial() == ModToolMaterials.RUBY){ - tooltip.add(Text.literal("")); - tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.auto_smelt").formatted(Formatting.DARK_RED))); + tooltip.add(Text.literal("")); + if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.ONYX) { + tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.wither_effect").formatted(Formatting.DARK_GRAY))); + } + if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.RUBY) { + tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.burn_effect").formatted(Formatting.DARK_RED))); } tooltip.add(Text.literal("")); // tooltip.add(Text.translatable("mores.harvest_level").formatted(Formatting.GRAY).append(Text.translatable(String.valueOf(item.getMaterial().getMiningLevel())).formatted(Formatting.GOLD))); diff --git a/src/main/java/mod/leronus/mores/item/custom/ModPickaxeItem.java b/src/main/java/mod/leronus/mores/item/custom/ModPickaxeItem.java index 598d076..96410e6 100644 --- a/src/main/java/mod/leronus/mores/item/custom/ModPickaxeItem.java +++ b/src/main/java/mod/leronus/mores/item/custom/ModPickaxeItem.java @@ -6,10 +6,7 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.item.ItemStack; -import net.minecraft.item.MiningToolItem; -import net.minecraft.item.PickaxeItem; -import net.minecraft.item.ToolMaterial; +import net.minecraft.item.*; import net.minecraft.text.Text; import net.minecraft.util.Formatting; import net.minecraft.world.World; @@ -38,9 +35,12 @@ public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attack @Override public void appendTooltip(ItemStack stack, TooltipContext context, List tooltip, TooltipType type) { if (stack.getItem() instanceof MiningToolItem item) { - if (item.getMaterial() == ModToolMaterials.RUBY){ - tooltip.add(Text.literal("")); - tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.auto_smelt").formatted(Formatting.DARK_RED))); + tooltip.add(Text.literal("")); + if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.ONYX) { + tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.wither_effect").formatted(Formatting.DARK_GRAY))); + } + if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.RUBY) { + tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.burn_effect").formatted(Formatting.DARK_RED))); } tooltip.add(Text.literal("")); // tooltip.add(Text.translatable("mores.harvest_level").formatted(Formatting.GRAY).append(Text.translatable(String.valueOf(item.getMaterial().getMiningLevel())).formatted(Formatting.GOLD))); diff --git a/src/main/java/mod/leronus/mores/item/custom/ModShovelItem.java b/src/main/java/mod/leronus/mores/item/custom/ModShovelItem.java index c97cc7a..3581976 100644 --- a/src/main/java/mod/leronus/mores/item/custom/ModShovelItem.java +++ b/src/main/java/mod/leronus/mores/item/custom/ModShovelItem.java @@ -6,10 +6,7 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.item.ItemStack; -import net.minecraft.item.MiningToolItem; -import net.minecraft.item.ShovelItem; -import net.minecraft.item.ToolMaterial; +import net.minecraft.item.*; import net.minecraft.text.Text; import net.minecraft.util.Formatting; @@ -36,9 +33,12 @@ public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attack @Override public void appendTooltip(ItemStack stack, TooltipContext context, List tooltip, TooltipType type) { if (stack.getItem() instanceof MiningToolItem item) { - if (item.getMaterial() == ModToolMaterials.RUBY){ - tooltip.add(Text.literal("")); - tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.auto_smelt").formatted(Formatting.DARK_RED))); + tooltip.add(Text.literal("")); + if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.ONYX) { + tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.wither_effect").formatted(Formatting.DARK_GRAY))); + } + if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.RUBY) { + tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.burn_effect").formatted(Formatting.DARK_RED))); } tooltip.add(Text.literal("")); // tooltip.add(Text.translatable("mores.harvest_level").formatted(Formatting.GRAY).append(Text.translatable(String.valueOf(item.getMaterial().getMiningLevel())).formatted(Formatting.GOLD))); diff --git a/src/main/java/mod/leronus/mores/item/custom/ModSwordItem.java b/src/main/java/mod/leronus/mores/item/custom/ModSwordItem.java index 0755509..220e139 100644 --- a/src/main/java/mod/leronus/mores/item/custom/ModSwordItem.java +++ b/src/main/java/mod/leronus/mores/item/custom/ModSwordItem.java @@ -2,13 +2,11 @@ import mod.leronus.mores.item.ModItems; import net.minecraft.item.tooltip.TooltipType; +import mod.leronus.mores.item.ModToolMaterials; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.SwordItem; -import net.minecraft.item.ToolMaterial; +import net.minecraft.item.*; import net.minecraft.text.Text; import net.minecraft.util.Formatting; @@ -23,15 +21,15 @@ public ModSwordItem(ToolMaterial toolMaterial, Item.Settings settings) { @Override public void appendTooltip(ItemStack stack, TooltipContext context, List tooltip, TooltipType type) { if (stack.getItem() instanceof ModSwordItem){ - tooltip.add(Text.literal("")); - if (stack.getItem() == ModItems.ONYX_SWORD || stack.getItem() == ModItems.ONYX_MACE || stack.getItem() == ModItems.ONYX_DAGGER) { - tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.wither_effect").formatted(Formatting.DARK_GRAY))); - } - tooltip.add(Text.literal("")); - tooltip.add(Text.translatable("mores.durability").formatted(Formatting.GRAY).append(Text.translatable(String.valueOf(((ModSwordItem) stack.getItem()).getMaterial().getDurability())).formatted(Formatting.LIGHT_PURPLE))); - if (stack.getItem() == ModItems.RUBY_SWORD || stack.getItem() == ModItems.RUBY_MACE || stack.getItem() == ModItems.RUBY_DAGGER) { - tooltip.add(Text.translatable(Formatting.GRAY + "mores.bonus" + Formatting.RED + "Burn Effect")); + tooltip.add(Text.literal("")); + if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.ONYX) { + tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.wither_effect").formatted(Formatting.DARK_GRAY))); + } + if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.RUBY) { + tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.burn_effect").formatted(Formatting.DARK_RED))); } + tooltip.add(Text.literal("")); + tooltip.add(Text.translatable("mores.durability").formatted(Formatting.GRAY).append(Text.translatable(String.valueOf(((ModSwordItem) stack.getItem()).getMaterial().getDurability())).formatted(Formatting.LIGHT_PURPLE))); } }