Skip to content

Commit

Permalink
Fixed ruby tools burn effect tooltip (and added to tools & battleaxe)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leronus committed Aug 9, 2024
1 parent 9e93530 commit 2a9ccce
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 39 deletions.
3 changes: 3 additions & 0 deletions MORES-CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v1.0.2
- Updated ruby tooltips (matched colors and fixed accidental double line)

v1.0.1
- Added bronze armor to trimmable armor
- Updated full armor effects to show infinite instead of a countdown timer that keeps refreshing
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/mod/leronus/mores/item/custom/ModAxeItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,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;
Expand Down Expand Up @@ -39,9 +36,12 @@ public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attack
@Override
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
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)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attack
@Override
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
if (stack.getItem() instanceof ModBattleAxeItem){
// tooltip.add(Text.literal(""));
// if (stack.getItem() == ModItems.ONYX_BATTLEAXE) {
// 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(stack.getItem().getMaxDamage())).formatted(Formatting.LIGHT_PURPLE)));
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.RED)));
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(stack.getItem().getMaxDamage())).formatted(Formatting.LIGHT_PURPLE)));
}
}
}
14 changes: 7 additions & 7 deletions src/main/java/mod/leronus/mores/item/custom/ModHoeItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
import net.minecraft.world.World;
Expand Down Expand Up @@ -38,9 +35,12 @@ public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attack
@Override
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
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)));
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/mod/leronus/mores/item/custom/ModPickaxeItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -38,9 +35,12 @@ public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attack
@Override
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
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)));
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/mod/leronus/mores/item/custom/ModShovelItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
import net.minecraft.world.World;
Expand Down Expand Up @@ -38,9 +35,12 @@ public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attack
@Override
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
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)));
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/mod/leronus/mores/item/custom/ModSwordItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ public Multimap<EntityAttribute, EntityAttributeModifier> getAttributeModifiers(
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
if (stack.getItem() instanceof ToolItem){
tooltip.add(Text.literal(""));
if (stack.getItem() == ModItems.ONYX_SWORD || stack.getItem() == ModItems.ONYX_MACE || stack.getItem() == ModItems.ONYX_DAGGER) {
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)));
}
tooltip.add(Text.literal(""));
tooltip.add(Text.translatable("mores.durability").formatted(Formatting.GRAY).append(Text.translatable(String.valueOf(stack.getItem().getMaxDamage())).formatted(Formatting.LIGHT_PURPLE)));
if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.RUBY) {
tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.burn_effect").formatted(Formatting.RED)));
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(stack.getItem().getMaxDamage())).formatted(Formatting.LIGHT_PURPLE)));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"mores.mixins.json"
],
"depends": {
"fabricloader": ">=0.15.3",
"fabricloader": ">=0.15.11",
"minecraft": "~1.20.1",
"java": ">=17",
"fabric-api": "*"
Expand Down

0 comments on commit 2a9ccce

Please sign in to comment.