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
Added bronze to trimmable armor
Updated fabric version
  • Loading branch information
Leronus committed Aug 8, 2024
1 parent 4ad814d commit 9e93530
Show file tree
Hide file tree
Showing 14 changed files with 123 additions and 23 deletions.
6 changes: 6 additions & 0 deletions MORES-CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
v1.0.1
- Added bronze armor to trimmable armor
- Updated full armor effects to show infinite instead of a countdown timer that keeps refreshing
- Updated item groups to match vanilla Minecraft item groups
- Fixed ruby tools burn effect tooltip (and added to tools)
- Harvest level (temporarily?) removed from tooltips on tools
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ dependencies {
modImplementation "maven.modrinth:SfMw2IZN:UO1crPGk"

//Custom Shields
modImplementation "com.github.CrimsonDawn45:Fabric-Shield-Lib:v${project.fabric_shield_lib_version}"
modImplementation "maven.modrinth:7SDalH12:xY16zX6k"
modImplementation "com.terraformersmc:modmenu:${project.mod_menu_version}"
modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}"
modImplementation "com.github.Chocohead:Fabric-ASM:v${project.fabricasm_version}"
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ org.gradle.parallel=true
# check these on https://fabricmc.net/develop
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
loader_version=0.15.3
loader_version=0.15.11

# Mod Properties
mod_version=1.0.1
maven_group=mod.leronus.mores
archives_base_name=mores

# Dependencies
fabric_version=0.91.0+1.20.1
fabric_version=0.92.2+1.20.1
sodium_version=mc1.20.1-0.5.3

fabric_shield_lib_version=1.7.2-1.20.1
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/mod/leronus/mores/item/custom/ModAxeItem.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package mod.leronus.mores.item.custom;

import mod.leronus.mores.item.ModArmorMaterials;
import mod.leronus.mores.item.ModItems;
import mod.leronus.mores.item.ModToolMaterials;
import net.minecraft.client.item.TooltipContext;
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;
Expand All @@ -19,6 +23,19 @@ public ModAxeItem(ToolMaterial material, float attackDamage, float attackSpeed,
super(material, attackDamage, attackSpeed, settings);
}

@Override
public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) {
//If the item is an onyx battleaxe, apply wither effect on targetEntity
if(stack.getItem() == ModItems.ONYX_AXE) {
target.addStatusEffect(new StatusEffectInstance(StatusEffects.WITHER, 250, 1, false, false));
}
//If the item is a ruby sword, apply fire effect on targetEntity
if(stack.getItem() == ModItems.RUBY_AXE) {
target.setOnFireFor(5);
}
return super.postHit(stack, target, attacker);
}

@Override
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
if (stack.getItem() instanceof MiningToolItem item) {
Expand Down
34 changes: 27 additions & 7 deletions src/main/java/mod/leronus/mores/item/custom/ModBattleAxeItem.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package mod.leronus.mores.item.custom;

import mod.leronus.mores.item.ModItems;
import mod.leronus.mores.item.ModToolMaterials;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.SwordItem;
import net.minecraft.item.ToolMaterial;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.*;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.world.World;
Expand All @@ -18,6 +19,25 @@ public class ModBattleAxeItem extends SwordItem {
public ModBattleAxeItem(ToolMaterial toolMaterial, int attackDamageModifier, float attackSpeedModifier, Item.Settings settings) {
super(toolMaterial, attackDamageModifier, attackSpeedModifier, settings);
}
/**
* Called when an enemy is attacked using the sword
* @param stack Itemstack used to attack with
* @param target Target entity that is being attacked
* @param attacker The entity attacking the enemy
* @return Hurt enemy
*/
@Override
public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) {
//If the item is an onyx battleaxe, apply wither effect on targetEntity
if(stack.getItem() == ModItems.ONYX_BATTLEAXE) {
target.addStatusEffect(new StatusEffectInstance(StatusEffects.WITHER, 250, 1, false, false));
}
//If the item is a ruby sword, apply fire effect on targetEntity
if(stack.getItem() == ModItems.RUBY_BATTLEAXE) {
target.setOnFireFor(5);
}
return super.postHit(stack, target, attacker);
}

@Override
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
Expand All @@ -28,9 +48,9 @@ public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> too
// }
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 (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"));
// }
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)));
}
}
}
}
17 changes: 17 additions & 0 deletions src/main/java/mod/leronus/mores/item/custom/ModHoeItem.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package mod.leronus.mores.item.custom;

import mod.leronus.mores.item.ModItems;
import mod.leronus.mores.item.ModToolMaterials;
import net.minecraft.client.item.TooltipContext;
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;
Expand All @@ -18,6 +22,19 @@ public ModHoeItem(ToolMaterial material, int attackDamage, float attackSpeed, Se
super(material, attackDamage, attackSpeed, settings);
}

@Override
public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) {
//If the item is an onyx battleaxe, apply wither effect on targetEntity
if(stack.getItem() == ModItems.ONYX_HOE) {
target.addStatusEffect(new StatusEffectInstance(StatusEffects.WITHER, 250, 1, false, false));
}
//If the item is a ruby sword, apply fire effect on targetEntity
if(stack.getItem() == ModItems.RUBY_HOE) {
target.setOnFireFor(5);
}
return super.postHit(stack, target, attacker);
}

@Override
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
if (stack.getItem() instanceof MiningToolItem item) {
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/mod/leronus/mores/item/custom/ModPickaxeItem.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package mod.leronus.mores.item.custom;

import mod.leronus.mores.item.ModItems;
import mod.leronus.mores.item.ModToolMaterials;
import net.minecraft.client.item.TooltipContext;
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;
Expand All @@ -18,6 +22,19 @@ public ModPickaxeItem(ToolMaterial material, int attackDamage, float attackSpeed
super(material, attackDamage, attackSpeed, settings);
}

@Override
public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) {
//If the item is an onyx battleaxe, apply wither effect on targetEntity
if(stack.getItem() == ModItems.ONYX_PICKAXE) {
target.addStatusEffect(new StatusEffectInstance(StatusEffects.WITHER, 250, 1, false, false));
}
//If the item is a ruby sword, apply fire effect on targetEntity
if(stack.getItem() == ModItems.RUBY_PICKAXE) {
target.setOnFireFor(5);
}
return super.postHit(stack, target, attacker);
}

@Override
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
if (stack.getItem() instanceof MiningToolItem item) {
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/mod/leronus/mores/item/custom/ModShovelItem.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package mod.leronus.mores.item.custom;

import mod.leronus.mores.item.ModItems;
import mod.leronus.mores.item.ModToolMaterials;
import net.minecraft.client.item.TooltipContext;
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;
Expand All @@ -18,6 +22,19 @@ public ModShovelItem(ToolMaterial material, float attackDamage, float attackSpee
super(material, attackDamage, attackSpeed, settings);
}

@Override
public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) {
//If the item is an onyx battleaxe, apply wither effect on targetEntity
if(stack.getItem() == ModItems.ONYX_SHOVEL) {
target.addStatusEffect(new StatusEffectInstance(StatusEffects.WITHER, 250, 1, false, false));
}
//If the item is a ruby sword, apply fire effect on targetEntity
if(stack.getItem() == ModItems.RUBY_SHOVEL) {
target.setOnFireFor(5);
}
return super.postHit(stack, target, attacker);
}

@Override
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
if (stack.getItem() instanceof MiningToolItem item) {
Expand Down
24 changes: 11 additions & 13 deletions src/main/java/mod/leronus/mores/item/custom/ModSwordItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Multimap;
import mod.leronus.mores.item.ModItems;
import mod.leronus.mores.item.ModToolMaterials;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.client.item.TooltipContext;
Expand All @@ -13,10 +14,7 @@
import net.minecraft.entity.attribute.EntityAttributes;
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.registry.tag.BlockTags;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
Expand Down Expand Up @@ -56,15 +54,15 @@ public Multimap<EntityAttribute, EntityAttributeModifier> getAttributeModifiers(

@Override
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
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(stack.getItem().getMaxDamage())).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"));
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) {
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)));
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/mores/lang/en_gb.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"mores.night_vision": "Night Vision",
"mores.water_effects": "Water Breathing & Dolphins",
"mores.wither_effect": "Wither Effect",
"mores.burn_effect": "Burn Effect",
"mores.auto_smelt": "Automatic Smelting",


Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/mores/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"mores.night_vision": "Night Vision",
"mores.water_effects": "Water Breathing & Dolphins",
"mores.wither_effect": "Wither Effect",
"mores.burn_effect": "Burn Effect",
"mores.auto_smelt": "Automatic Smelting",


Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/mores/lang/nl_nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"mores.night_vision": "Nachtzicht",
"mores.water_effects": "Wateradem & Gunst der dolfijnen",
"mores.wither_effect": "Verschrompelingseffect",
"mores.burn_effect": "Verbrandingseffect",
"mores.auto_smelt": "Automatisch Smelten",

"sound.mores.living_duck_sound" : "Eend kwaakt",
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/mores/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"mores.night_vision": "夜视",
"mores.water_effects": "水下呼吸 & 海豚的恩惠",
"mores.wither_effect": "凋零",
"mores.burn_effect": "Burn Effect",
"mores.auto_smelt": "自动熔炼",


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
"mores:copper_chestplate",
"mores:copper_leggings",
"mores:copper_boots",
"mores:bronze_helmet",
"mores:bronze_chestplate",
"mores:bronze_leggings",
"mores:bronze_boots",
"mores:silver_helmet",
"mores:silver_chestplate",
"mores:silver_leggings",
Expand Down

0 comments on commit 9e93530

Please sign in to comment.