Difference between revisions of "Item stack"

From Minetest Wiki
Jump to navigation Jump to search
m
(→‎Appearance: Mention push-out)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Languages}}
+
{{Languages|nocat=1}}
 
+
{{Object Data
 +
|name=Dropped item stack
 +
|image=Item entity.png
 +
|entitystring=__builtin:item
 +
|collides_with_blocks=Yes
 +
|collides_with_objects=No
 +
|health=∞
 +
}}
 
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.
 
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 ==
 
== Appearance ==
Item stacks be stored in [[inventory|inventories]] and can also appear in the world itself.
+
Item stacks can be stored in [[inventory|inventories]] and can also appear in the world itself.
  
 
=== In an inventory ===
 
=== In an inventory ===
Line 11: Line 18:
 
=== In the world ===
 
=== In the world ===
 
[[File:Item stacks in the world.png|thumb|250px|Some dropped item stacks]]
 
[[File:Item stacks in the world.png|thumb|250px|Some dropped item stacks]]
In the world, item stacks are also represented by some sort of symbol. For blocks, the icon is a rotating mini-version of it. Basicly everything else is represented by the inventory icon. Item stacks can appear for several reasons in the world: You drop them, you tried to mine something but your inventory is full and for several other reasons. If you see an item stack in the world, you can collect it by pressing the attack key (<kbd>left click</kbd> usually) on it. It will appear in the [[Inventory#Player inventory|player inventory]] if there is enough space. In the world, any item stack appears as if it is just one single item. It is not possible to see the size of an item stack until you’ve collected it.
+
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]] (<code>item_entity_ttl</code>).
 +
 
 +
An item stack that is stuck in a solid block will be pushed outside of it until it reaches a non-solid block.
  
== Item stacks in the [[vanilla Minetest game]] ==
+
Dropped items can appear for many reasons:
All tools and weapons have a stack limit of 1. All other items have a stack limit of 99.
+
* a player drops them
 +
* a player mines a block, but there's no more space in the inventory
 +
* a [[Mobs|mob]] or a player dies
 +
* other events are possible
  
== Item stacks in other [[game]]s ==
+
== Modding Item stacks ==
Other games can set the stack limit freely for all items. It defaults to 99 for ordinary items and to 1 for tools. It is unlikely, if not impossible for tools to have a different stack limit.
+
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
  
[[Category:GUI]]
+
[[Category:Engine]]
[[Category:Gameplay]]
 

Latest revision as of 17:56, 3 February 2022

Languages Language: English • Deutsch • français • Bahasa Melayu
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