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

[OpenPeripherals] Terminal Glasses addIcon Question

Started by Whitecatblack, 14 April 2016 - 12:43 AM
Whitecatblack #1
Posted 14 April 2016 - 02:43 AM
So I've been fooling around with the terminal glasses, specifically the addIcon method. The method itself requires an x position and a y position where the icon will be placed on the screen, a string of the item id to be placed on the screen, and an optional metadata {addIcon(x, y, id, metadata)}.

So, I know the id parameter requires a string, but I've seen some older code around that would call addIcon with a number id instead of a string (ie. 1 instead of "minecraft:stone"). I'm assuming this was just before minecraft changed its naming system, yet I can still call addIcon with a number id, kinda.

If I do some code like this:

glass = peripheral.wrap("right") --to a terminal bridge
icon = glass.addIcon(15, 15, 1)
glass.sync()

the code won't throw an error. But it also won't show any icons on the screen. It will, however, still create the object, because I can still change it and create a visible icon:

icon.setItemId("minecraft:diamond")
glass.sync()
This changes the icon to a diamond and it will now show up on my screen in the expected place.

So my question is this: why is the icon object still created with the number id? Also, is there a way I can use the method with a number id, considering that even the vanilla /give command can use both item id strings and item id numbers? And finally, is there an easy way to see the different item id strings in game (through nei or something else)? Because, although it's easy enough to remember the vanilla items, I don't really have much hope knowing mod item string ids.

Thanks,
Whitecatblack
Bomb Bloke #2
Posted 14 April 2016 - 03:12 AM
And finally, is there an easy way to see the different item id strings in game (through nei or something else)? Because, although it's easy enough to remember the vanilla items, I don't really have much hope knowing mod item string ids.

The only mod I'm aware of that helps with this is an older version of MoarPeripherals, which offered an Item Dictionary block for exactly this sort of thing. It was removed from later builds and last appeared in version 1.4. That's available for both MC 1.6.4 and 1.7.10, though I'm not sure the Dictionary ever worked under the latter…

http://minecraft.curseforge.com/projects/moarperipherals/files
Whitecatblack #3
Posted 14 April 2016 - 06:24 AM
The only mod I'm aware of that helps with this is an older version of MoarPeripherals, which offered an Item Dictionary block for exactly this sort of thing … though I'm not sure the Dictionary ever worked under the latter…

Yeah it seems to be broken for me. Do you have any advice on something else to figure out the string ids? I figured out a way to configure WAILA to show both the string id and number id, but that doesn't really help for items that you can't place or items that you don't have nearby…
Edited on 14 April 2016 - 04:25 AM
Stekeblad #4
Posted 14 April 2016 - 07:40 AM
Close all GUIs and press F3+ H and then open your inventory, if you hover over an item it will now have some more information in the tool tip. It is safe to press F3 to hide the coordinates and stuff without the extra information disappearing. To remove it, press F3 + H again.

Have you looked at NEI options, open inventory and bottom left?

I think you can use Computercraft as well, wrapping a chest as a peripheral containing the item/block and use a function (don't remember the name) to get information on the item/block, in the table you get you have rows containing ID.
Whitecatblack #5
Posted 14 April 2016 - 11:56 PM
Close all GUIs and press F3+ H and then open your inventory, if you hover over an item it will now have some more information in the tool tip. It is safe to press F3 to hide the coordinates and stuff without the extra information disappearing. To remove it, press F3 + H again.

Thanks Stekeblad, exactly what I was looking for.