CC: Tweaked

CC: Tweaked

42M Downloads

Query Turtle's Tool Durability

GravityCY opened this issue ยท 1 comments

commented

Allow for querying the Tools of a Turtle

This could be done by having a turtle.getLeftTool() and turtle.getRightTool() function, that returns information about the item just like it would for when you'd do turtle.getItemDetail(slot, true) (maybe).

My Reasoning

I have durability and enchantments enabled.

I don't want to break the turtles tool.
Unequipping, doing turtle.getItemDetail and checking the damage definitely works, but it has it's flaws, and adds to unnecessary complexity for a fairly simply problem.


Imagine this, you have a Pickaxe with Unbreaking 3, and you want to mine, how often should you unequip the tool, check the durability and requip it, should you cache the durability and then assume it everytime you mine a block, with Unbreaking it means you have to assume the lowest durability, check when the assumed durability is low enough, what if your inventory is full at that moment, should you drop something, unequip, check the durability, requip, and then pick the dropped item back up?


Not sure but some blocks also do 2x damage to tools, so you'd have to know how to correctly track the cached durability aswell, like leaves and swords but that's really specific lol (I guess some modded blocks might do that too which makes tracking durability kinda hard)

commented

I recently wrote an aide library for the turtles to determine what upgrades are currently installed, and I can definitely confirm that it is a bit weird to get the equipped module information currently. There's a lot going into simply determining what the turtle has installed, and the requirement for a free slot to unequip to in order to check can be annoying at times.