Game Maker

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.

  1. Event: Player Interact Entity event on a Villager.
  2. Action: Conditional action.
  3. Configuration:
    • Condition: Has Item Condition
      • Material: WHEAT
      • Amount: 10
    • If Actions:
      • Remove Item action to take 10 Wheat from the player.
      • Give Item action to give the player their reward.
      • Send Message action saying "Thank you for the wheat!"
    • Else Actions:
      • Send Message action saying "Come back when you have 10 wheat!"