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

Share this post


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

 

Share this post


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'

Share this post


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...

Share this post


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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

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