set Item

Set some amount of blocks or items in an inventory slot.

agent.setItem(0, 0, 0);

Parameters

  • blockOrItem: the block or item to place in a slot
  • count: the number of blocks or items to put in the slot
  • slot: the slot index to put the blocks or items in, from 1 to 27, eg: 1

Example

Set 4 blocks of dirt in slot 2 and display how many blocks of dirt the agent has.

agent.setItem(DIRT, 4, 2)
player.say("Number of items in slot 2 = " + agent.getItemCount(2));

See Also

get item count