Getting # of slots of an adjacent block and other inventory handling questions

Started by Shadetree on Wed, 06/16/2021 - 06:20

Topic category: Help with modding (Java Edition)

Last seen on 18:57, 11. Jul 2021
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Getting # of slots of an adjacent block and other inventory handling questions
Wed, 06/16/2021 - 06:20

Perhaps I'm missing something obvious but I can not for the life of me figure out how to dynamically iterate how many slots a block like a chest or dispenser has.  I'd like to be able to push items into an adjacent inventory which could be anything from a normal chest to some modded block with n slots.

 

In a similar vein.  putting an item into an adjacent inventory (like a chest) by having to define which slot which seems limiting.  I'd like to just put it into first available slot similar to how shift-clicking from your inventory into a chest does.  either add it to a pre-existing non-full stack or put it into an empty slot.  I'm almost sure I could maybe create a procedure to do this after a few headaches and tears, but I'd need to be able to iterate dynamically how many slots I'm dealing with.

Last seen on 22:39, 28. Jul 2021
Joined Jan 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
If I'm not wrong the 00 slot…
Wed, 06/16/2021 - 21:55

If I'm not wrong the 00 slot has shift clicking priority. So in short terms the lowest number is the one it will prioritize.