if (target.interact("Attack")) ;
The ";" shouldn't be there, also look into Lambda expressions for the conditional sleep: https://osbot.org/forum/topic/127193-conditional-sleep-with-lambda-expressions/
if (!myPlayer().isUnderAttack() && myPlayer().getInteracting() == null && targetTile != null)
I didn't look very well at the code but I'm pretty sure the mistake is in here.
Fixing the above mistake might fix this too, but it's probably still detecting that your player is under attack or interacting with something when it gets to this point & thus skipping the loot function.