Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading description instead of NBT data #1019

Closed
LordTy opened this issue Apr 5, 2015 · 10 comments
Closed

Reading description instead of NBT data #1019

LordTy opened this issue Apr 5, 2015 · 10 comments

Comments

@LordTy
Copy link

LordTy commented Apr 5, 2015

I have seen a few request for the reading of NBT data, which are understandably denied.

However, I think a way to allow us to still sort items based on NBT data that is visible to the player (eg safari nets, seeds, bees) would be to expose the description string of the item.

Then it is up to the programmer to correctly parse this string and it allows the mod-makers to decide which data is visible.

@Vexatos
Copy link
Contributor

Vexatos commented Apr 5, 2015

... Database upgrades exist...

@Kubuxu
Copy link
Contributor

Kubuxu commented Apr 5, 2015

And many ad suggested items already have special converters.

@gjgfuj
Copy link

gjgfuj commented Apr 5, 2015

I agree with this, however, the description string is client side and as
such cannot be read by computers.

On Sun, 5 Apr 2015 7:01 pm Vexatos notifications@github.com wrote:

... Database upgrades exist...


Reply to this email directly or view it on GitHub
#1019 (comment)
.

Sorry, something went wrong.

@fnuecke
Copy link
Member

fnuecke commented Apr 5, 2015

Well, all of the arguments against this I immediately thought of were already mentioned. Just wanna expand on those points a bit more:

  • You can sort items, including based on NBT data, using the database upgrade, by getting the hash of an item in the database (database.computeHash()).
  • If there is anything specific, a converter is the sane way to go - text parsing on the Lua side is unnecessarily error prone, for one simply because it's string parsing, for two because it involves localization on the server, which is nothing one should rely on, ever (yes, usually it boils down to resulting in the English strings, but still).
    There are converters for safari nets and bees already, for example (though the one for the bees only works while the bee is in the analyzer or a bee house/apiary/alveary... if I don't forget again I'll make that work for plain item stacks, too...)

Sorry, something went wrong.

@fnuecke fnuecke closed this as completed Apr 5, 2015
@LordTy
Copy link
Author

LordTy commented Apr 7, 2015

I understand the error proneness of the string parsing, but this was the best I could think of. The converters I haven't seen before, is there somewhere I can find more information on them?

The problem I had with using a database to sort the items was that a database can only compare to known items, which severely limits the uses when trying to automate breeding processes.

@fnuecke
Copy link
Member

fnuecke commented Apr 7, 2015

Example using Java in case you're unfamiliar with Scala. As you see, it's quite simple to make one.

@gjgfuj
Copy link

gjgfuj commented Apr 7, 2015

I think what they were referring to is how to access the converters lua
side.

On Tue, 7 Apr 2015 7:22 pm fnuecke notifications@github.com wrote:

Example using Java
https://github.com/MightyPirates/OpenComputers/blob/master-MC1.7.10/src/main/scala/li/cil/oc/integration/ic2/ConverterElectricItem.java
in case you're unfamiliar with Scala. As you see, it's quite simple to make
one.


Reply to this email directly or view it on GitHub
#1019 (comment)
.

@Vexatos
Copy link
Contributor

Vexatos commented Apr 7, 2015

trying to automate breeding processes

@LordTy I hope you know that there is a special converter for Bees so automating bee breeding already is easily possible.

@fnuecke
Copy link
Member

fnuecke commented Apr 7, 2015

I think what they were referring to is how to access the converters lua side.

Ah, well that's automatic - given some callback returns the converted type. Such as the getStackInSlot method of the inventory controller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants