Help with Changing Blockstate Based on Specific Item and Inventory Slots

Started by Eli338 on

Topic category: Help with MCreator software

Joined Feb 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help with Changing Blockstate Based on Specific Item and Inventory Slots
Tue, 02/18/2025 - 07:30 (edited)

Hi everyone, I've been using MCreator for about a week now, and I'm currently working on a procedure that changes the blockstate of a custom block based on the number of a specific item in its inventory.

 

https://imgur.com/a/8NBt5uE.png

 

Here's how my Procedure works:

- I have a block called AmmoDrum_empty, which has three blockstates: AmmoDrum_filled1, AmmoDrum_filled2, and AmmoDrum_filled3.  

- If the number of items in slot 0 is:

  •  1 item: The blockstate changes to  AmmoDrum_filled1.
  • 2 items: The blockstate changes to AmmoDrum_filled2.
  • 3 or more items: The blockstate changes to AmmoDrum_filled3.  
  • If there are no items in its inventory, the block reverts to its default AmmoDrum_empty state.

Issues I'm Facing:

1. How do I make the blockstate change only when a specific item (bullet_item) is in the inventory? Currently, it changes states regardless of the item type inside it.

2. How can I check all the slots in the inventory instead of just slot 0? Right now, it's only detecting the count in the slot 0 or first slot.

I would appreciate any guidance on how to properly implement these conditions in my procedure. Thanks in advance!

Edited by Eli338 on Tue, 02/18/2025 - 07:30