This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Purple's profile picture

Item name discrepancy

Started by Purple, 03 December 2017 - 04:19 PM
Purple #1
Posted 03 December 2017 - 05:19 PM
Details you might want:
Game Version: 1.7.10
Mod Version: 1.74 + OpenCCSensors 1.75

Question:
I am working on an automatic warehouse using turtles and inventory sensors. However I have come upon a problem I am incapable of circumventing. In particular, the sensor peripherals from that mod return item names in a format incompatible with that provided by the Turtle API and I am unable to find a pattern which would allow me to easily convert between the two.

For example:
Item: IC2 copper ore

turtle.getItemDetail([slotNum]) -> minecraft:blockICopperOre
mySensor.getTargetDetails([target])["Name"] -> Copper Ore
mySensor.getTargetDetails([target])["RawName"] -> ic2.copper ore


As demonstrated, this difference makes it impossible for me to easily take sensor inputs and turtle inputs and use them interchangably in the same system. And this is something I need to do.

Has anyone come across this issue before and written some sort of code that could easily convert between them without me having to manually gather item names and write a giant table?
SquidDev #2
Posted 03 December 2017 - 09:43 PM
Sadly there isn't an easy way to do this: Turtles use the unique ID (or registry name) of but OpenCCSensors uses the language key. If you've got OpenPeripherals installed, I believe they offer a way to get the registry name. If not, I suspect you're stuck with a manual lookup table.
Purple #3
Posted 03 December 2017 - 09:58 PM
I see. Is there any good way to batch up the process than? Not nessecerily using computercraft it self or even minecraft either. Just some way of extracting the whole list of registry name, language key and proper name for each item so that I don't have to manually collect them for each item in the game? I'd be open to say using an external plugin or something that just cracks open the game files and dumps them all out. I know NEI has something similar but I don't know how to use it.
Purple #4
Posted 03 December 2017 - 10:07 PM
Double post because I can't edit because I can't get approved yet.

I've figured out the NEI dumps and am starting to brute force it by using them to assemble a giant lookup table. Will report back with the results. Also if it works I will likely publish my code as an API so that other people don't have to thrudge through this. Although you'll need to use your own NEI dumps for the actual data.
Purple #5
Posted 04 December 2017 - 11:16 AM
Update: I have decided to just circumvent the problem alltogether by approaching it from the angle of coordinates rather than item names. After all I am runing a warehouse with one chest per item type so that should work.

case closed