Skip to content

Commit

Permalink
Couple of tool damage fixes
Browse files Browse the repository at this point in the history
Do not damage tools for breaking blocks if they are not harvest tools and not shears
Do not show durability bar if the tool does not have durability and no modifier asked for it
  • Loading branch information
KnightMiner committed Feb 14, 2023
1 parent b6460c7 commit f19b43b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import slimeknights.tconstruct.common.TinkerTags;
import slimeknights.tconstruct.library.modifiers.ModifierEntry;
import slimeknights.tconstruct.library.tools.nbt.IToolStackView;
import slimeknights.tconstruct.library.tools.nbt.ToolStack;
Expand Down Expand Up @@ -187,7 +188,7 @@ public static boolean showDurabilityBar(ItemStack stack) {
return show;
}
}
return tool.getDamage() > 0;
return tool.getDamage() > 0 && stack.is(TinkerTags.Items.DURABILITY);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private ToolHarvestLogic() {}
* @return Damage to deal
*/
public static int getDamage(ToolStack tool, Level world, BlockPos pos, BlockState state) {
if (state.getDestroySpeed(world, pos) == 0) {
if (state.getDestroySpeed(world, pos) == 0 || !tool.hasTag(TinkerTags.Items.HARVEST)) {
// tools that can shear take damage from instant break for non-fire
return (!state.is(BlockTags.FIRE) && ModifierUtil.canPerformAction(tool, ToolActions.SHEARS_DIG)) ? 1 : 0;
}
Expand Down

0 comments on commit f19b43b

Please sign in to comment.