Item stack

From Minetest
Revision as of 09:56, 3 February 2022 by >Wuzzy (→‎Appearance: Mention push-out)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Dropped item stack
Item entity.png
An object in Minetest
Health
Object collision No
Block collision Yes
Entitystring __builtin:item

An item stack is a collection of multiple items of the same type. Any item type has a stack limit, it is not possible to stack more items of such an item than the stack limit.

Appearance

Item stacks can be stored in inventories and can also appear in the world itself.

In an inventory

In the inventory, item stacks are represented by an icon and optionally a number. The number is the size of the item stack. If there is no number, the size is 1. Refer to Inventory#Controls for instructions how to use item stacks in inventories.

In the world

Some dropped item stacks

Item stacks appear in the world as objects. They are represented by some sort of symbol. For blocks, the icon is a rotating mini-version of it. Other things represented by the inventory icon. In the world, any item stack appears just as a single object, even with a stack size of 99. But item stacks with a larger stack size will appear larger than item stacks with a low stack size. An item stack can be collected by punching it. Item stacks are subject to gravity. If multiple item stacks of the same item occupy the same block position, they will merge into one object, as long the stack limit is not exceeded. Dropped items also have a life time. If they stay untouched in the world for too long, they disappear. The life time can be changed via minetest.conf (item_entity_ttl).

An item stack that is stuck in a solid block will be pushed outside of it until it reaches a non-solid block.

Dropped items can appear for many reasons:

  • a player drops them
  • a player mines a block, but there's no more space in the inventory
  • a mob or a player dies
  • other events are possible

Modding Item stacks

Mods can change the stack limit, or the behaviour of the dropped items.

For example:

  • Item magnet: When a player stands close to a dropped item, it gets attraced like a magnet and will be automatically collected. Punching it is not required
  • Water flow: Dropped items move with the flow of water
  • Destruction: Dropped items get destroyed if they touch lava or fire