OpenMods / OpenPeripheral

https://openmods.info
MIT License
67 stars 25 forks source link

Added more item data for vanilla item stacks. #119

Closed AdmiralFrijoles closed 10 years ago

AdmiralFrijoles commented 10 years ago

I have exposed a few more properties for item stacks. The compound tag of the item stack is the most interesting as it allows access to data that would otherwise be unavailable. It can also be used to further compare stacks in Lua. I have also exposed the item's max damage to allow for displaying durability as a percentage, as well as checking if the item is even damageable at all. I have also included "maxStackSize" and "isStackable" for good measure. I know I would use all of these quite regularly, I feel as though others would find all of this extremely useful as well.

mikeemoo commented 10 years ago

Hi, thanks for the PR, however exposing NBT data to the user isn't something I feel comfortable with. It's not meant for public consumption.

AdmiralFrijoles commented 10 years ago

I can see where you are coming from on that. I do feel however that there needs to be a way to compare item stacks further. I ran into a bit of a bump with a couple of items that are only differ in their tags.

Vexatos commented 10 years ago

How about adding an "Item Analyser" Block to https://github.com/OpenMods/OpenPeripheral-Addons/ to add some cost to this feature as it allows a lot of very advanced stuff? Also, then it could be easily disabled in the config file by setting the block's ID to 0, in case some server do not want this.

mikeemoo commented 10 years ago

Then something like areStacksIdentical should be used to check two slots against each other.

Exposing NBT has been discussed for a long time and we've always decided against it. It seems far too much of an intrusion into other mods code and methods. Some data is meant to be private.

I'd much rather code be added to append additional information to certain items than to blanket-expose everything.

mikeemoo commented 10 years ago

Vexatos, no. Its not the cost that is the issue.

Vexatos commented 10 years ago

@mikeemoo But there definitely needs to be an option to disable this on a server.

AdmiralFrijoles commented 10 years ago

OK, I see what you mean. There could potentially be some sensitive information in the tag I guess. As far as the other properties go those are OK yes?

mikeemoo commented 10 years ago

Yup the others seem fine!

AdmiralFrijoles commented 10 years ago

@mikeemoo Alrighty, thanks for the quick replies! I did find it odd that there was no way to access the NBT data, however I understand why now haha. I do personally think that the feature should be available as a config option though, but that is ultimately up to you. Anyway, thanks again.