OpenMods / OpenPeripheral-Addons

An addon for OpenPeripheral, adding physical blocks and items to the game
MIT License
11 stars 10 forks source link

addIcon (terminalGlasses) #87

Open clienthax opened 8 years ago

clienthax commented 8 years ago

Can we get a method for drawing a icon with a itemstack table reference, or at the very least a way to include nbt? im trying to make a forestry bee display, but as theres no way to add the nbt to the displayed stack, they all show as the base bee

boq commented 8 years ago

We are not planning to expose raw NBT. Getting information just about icon on server side is also mostly impossible.

Only thing I can do is to create element that displays icon from texture sheet (items or blocks). But it's not enough for bees, since they are more complicated (built-in bees have 3 layers, and modded ones can be even more complex).

clienthax commented 8 years ago

What about a method that would just pass the mc stack to the itemicon data, say from a inv connected to the network, without allowing the player to mess with the actual data? or are you saying the render method just isnt good enough in addons for it ?

boq commented 8 years ago

The problem is in Lua-Java barrier - since user has to set this via Lua code, itemstack must cross it at least twice (Java->Lua and Lua->Java).

While it could be doable in OpenComputers, ComputerCraft lacks method to create opaque container ("userdata") which could be used to hide information from user, but still keep it available to OpenPeripheral.

clienthax commented 8 years ago

Could you not keep a reference to the original data it in the backend of openp, or does that get lost over the barrier?

boq commented 8 years ago

Well, I can keep it, but then how will OpenPeripheral find out, where to find this data? Only idea I have is to keep index to table of items somewhere in structure returned to Lua. But that creates few problems, since users can freely modify this data and, for example, access items from other players (even if I create one table per computer). Also, there is problem with garbage collecting (when should item be removed from cache?).

PS. Couldn't answer earlier due to Internet problems.