CC: Tweaked

CC: Tweaked

57M Downloads

Expose `nbt` from non-detailed `turtle.getItemDetail`

hugeblank opened this issue · 7 comments

commented

Funnily enough, the issue prior to this one (#1300) narrowly misses addressing this. I believe it's a bit ridiculous that the turtlesgetItemDetail tells less about its own inventory than the getItemDetail for a remotely attached inventory peripheral. At the bare minimum it should provide nbt, bringing it to parity with an item in an inventory list call. I'd argue however that perhaps a turtle.list method should be implemented, that provides the same detail as calling list on an inventory, and then getItemDetail be brought to parity with its inventory counterpart.

commented

let it be known that three people were sitting in front of a turtle like monkies in front of a typewriter trying to figure this out. Thank you for reminding us to check the documentation sometimes.

commented

It might be possible for us to safely return the nbt hash without running on the main thread if we change how we snapshot the turtle's inventory. Will leave this open to remind me to look at that.

commented

turtle.getItemDetail accepts a detailed parameter, which reports more information (including the nbt hash).

turtle.getItemDetail doesn't return that by default, as it runs on the computer thread rather than the main thread, so isn't as thread safe.

commented

I'd argue however that perhaps a turtle.list method should be implemented
@hugeblank

You can make your own implementation for this.
I made this back in the Plethora days before CC had it's own item API, so it may be out of date.
https://github.com/Lupus590-CC/CC-Random-Code/blob/master/src/turtleGenericInventoryProxy.lua#L15-L20

commented

You should be able to turtle.getItemDetail(Slot, true)

commented

turtle.getItemDetail accepts a detailed parameter, which reports more information (including the nbt hash).

Squid addressed that. see above.

commented

Yeah I know it just wasn’t clearly said how to. Aka needing a Boolean to get the detailed information. I had to do some troubleshooting because I was using the computer craft original documentation which in this particular case has changed, compared to cc documentation.