Get items in block entity's inventory for custom crafting station

Started by LunarArmageddon99 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Aug 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Get items in block entity's inventory for custom crafting station

I'm currently recreating a mod I previously made and got working mostly properly.
A feature that worked in the previous version of the mod was a custom crafting station.  The way it worked was that it checked three slots for their proper items, and if the items matched a certain combination, it would delete the items in those slots and create the desired output in the output slot.  However, the problem with this is that I was checking each given slot to see if it had the right item in it, so the crafting recipes would only work in one specific order (A item has to be in X slot, B item has to be in Y slot, C item has to be in Z slot, but if item B is in slot Z for example, it won't work), and I'd have to communicate the order to anyone I was giving the recipes.  Not very user friendly.
So when recreating the mod, I decided to try and solve this problem.  Now, rather than searching every slot for the desired item, the procedure (of course, after checking to make sure that the output is empty) checks the inventory of event/target entity for the desired items overall, regardless of slot (stacked if/else if gates, which have no else condition and do nothing if improperly activated, and check "Has [Event/Target entity] in inventory [item]" as their condition).  And I'm also testing a simple little 'error code' system where I put a certain sound effect on the end as an else condition of some of the earlier if conditions in the stack.  To be more specific, I have it set to play the sound of a bell when everything leading up to the recipe is working but the recipe is invalid (at least one missing ingredient for a recipe).
All that is to say that I know for (almost) absolutely certain that checking the overall inventory of the block entity is not working as it should in this case.  Why?  Is there some way I could fix it, or something else I could do without either having the recipes be restricted to a certain order or brute forcing it and checking every possible valid combination?