Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
bufu1337

Refined Storage API - getItem

Question

How to search for a specific Item which has a tag?
for example output from crafttweaker: <"tconstruct:pick_head">.withTag({Material: "stone"})

i tried different ways with a refined storage system with only this item in it...

component.block_refinedstorage_grid_2.getItem({name="tconstruct:pick_head", withTag={material="stone"}})
component.block_refinedstorage_grid_2.getItem({name="tconstruct:pick_head", Tag={material="stone"}})
component.block_refinedstorage_grid_2.getItem({name="tconstruct:pick_head", nbt={material="stone"}})
component.block_refinedstorage_grid_2.getItem({name="tconstruct:pick_head", meta={material="stone"}})
component.block_refinedstorage_grid_2.getItem({name="tconstruct:pick_head", material="stone"})

 

everything results in nil, but:

component.block_refinedstorage_grid_2.getItems()

finds it... but I cant use getItems() in my original system because it will result in a too long list

Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

the `block_refinedstorage_grid_2` component is kindly provided by refined storage: https://github.com/raoulvdberge/refinedstorage

And in their integration source, they provide the `getItem` component method: https://github.com/raoulvdberge/refinedstorage/blob/mc1.12/src/main/java/com/raoulvdberge/refinedstorage/integration/oc/EnvironmentNetwork.java#L299

I don't know how their compare methods work (you can ask them for more support)

But it looks like their getItem method takes a couple extra boolean params for comparing meta and nbt. perhaps you could try `getItem({...}, true, true)` or some variation of those

 

Link to post
Share on other sites
  • 0
4 hours ago, payonel said:

...

But it looks like their getItem method takes a couple extra boolean params for comparing meta and nbt. perhaps you could try `getItem({...}, true, true)` or some variation of those

 

oh ups i forgot to write this in the my question

of course i used `getItem({...}, true, true)`

somehow refined storage compares it... because with getItems() i get a table with 'hasTag=true'

Link to post
Share on other sites
  • 0
On 10/7/2018 at 9:03 PM, payonel said:

the `block_refinedstorage_grid_2` component is kindly provided by refined storage: https://github.com/raoulvdberge/refinedstorage

And in their integration source, they provide the `getItem` component method: https://github.com/raoulvdberge/refinedstorage/blob/mc1.12/src/main/java/com/raoulvdberge/refinedstorage/integration/oc/EnvironmentNetwork.java#L299

I don't know how their compare methods work (you can ask them for more support)

But it looks like their getItem method takes a couple extra boolean params for comparing meta and nbt. perhaps you could try `getItem({...}, true, true)` or some variation of those

 

https://github.com/raoulvdberge/refinedstorage/issues/2028

any other suggestions here?

the guys from refined storage couldnt help me out, still doesnt work to search for an item with a specific tag like in my example...

Link to post
Share on other sites
  • 0

I read what RS devs had to say about the issue, and the problem you are running into is that you are trying to make an exact match, which requires you to specify all the tags of an item. You can't omit some you don't care about. I recommend you do a more general search for items, select the one you care about, and then reuse the search result for future exact searches.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.