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

TheTrue_DV

Members
  • Content Count

    2
  • Joined

  • Last visited

Posts posted by TheTrue_DV

  1. Basically... I want to have my robot hover over to a chest, count how many occupied slots there are and do something based on that count.

    What I tried was:

     

    Assuming that "ic" is "component.inventory_controller"

     

    `ic.getAllStacks(sides.front)`

    I was assuming that would offer something along the lines of 'ic.getAllStacks(sides.front).slotsOccupied() which would return what I was looking for... I found 'ic.getAllStacks(sides.front).count()' which I thought would do exactly what I wanted!

    Then I found out that did the exact same thing as 'ic.getInventorySize()'. Returning the total number of slots in the entire inventory... I don't really understand why we have two functions that do the exact same thing, but oh well...

    The other options are `.getAll()` and `.reset()`.

     

    The solution i've gone for, which is incredibly memory intensive, is to `.getAll()`and then interate through that map to count each slot that isn't "air" and then return that number... It works, but I really struggle to believe there isn't a function premade for that...

     

    So question is:

     

    Is there a better way of going about that?

     

×
×
  • Create New...

Important Information

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