LogicUsing Conditions
Has Item Condition
Check if a player has a specific item in their inventory.
The Has Item Condition checks if a player's inventory contains a certain quantity of a specific item.
Configuration
- Material: The type of item to check for (e.g.,
DIAMOND,OAK_LOG). - Amount: The minimum number of that item the player must have. The condition checks the total amount across all inventory stacks.
Use Cases
- Creating a door that requires a "Key" (e.g., a named Tripwire Hook) to open.
- A crafting system where you check if a player has the required resources before giving them the crafted item.
- A quest objective where a player must collect 10 wool.
Example: A Quest Turn-In
A player needs to turn in 10 Wheat to an NPC.
- Event:
Player Interact Entityevent on a Villager. - Action:
Conditionalaction. - Configuration:
- Condition:
Has Item Condition- Material:
WHEAT - Amount:
10
- Material:
- If Actions:
Remove Itemaction to take 10 Wheat from the player.Give Itemaction to give the player their reward.Send Messageaction saying "Thank you for the wheat!"
- Else Actions:
Send Messageaction saying "Come back when you have 10 wheat!"
- Condition: