I'm trying to add climbing claws that'll take durability while you climb and my item won't take durability when I have this conditions set but everything else works
public void inventoryTick(ItemStack stack, World world, Entity entity, int slot, boolean selected) {
if (!stack.isOf(ModTools.CLIMBING_CLAW) || !selected) {return;}
if (entity instanceof LivingEntity livingentity) {
if (startPos == null) {startPos = livingentity.getBlockPos();}
HitResult hit = entity.raycast(1,0,false);
stack.set(ModComponents.CAN_CLIMB_ON_BLOCK,CanClimb(hit,livingentity));
BlockPos currentpos = livingentity.getBlockPos();
boolean didYChange = startPos.getY() != currentpos.getY();
if (livingentity.horizontalCollision && !livingentity.getBlockStateAtPos().isIn(BlockTags.CLIMBABLE)) {
System.out.println("HELP ME");
stack.damage(1,livingentity,EquipmentSlot.MAINHAND);
startPos = null;
}
}
}```