Modding:Basic Inventory Handling: Difference between revisions

From Vintage Story Wiki
Marked this version for translation
mNo edit summary
(Marked this version for translation)
Line 1: Line 1:
{{GameVersion|1.15}}
{{GameVersion|1.15}}
<languages/><translate>
<languages/><translate>
== Overview ==
== Overview == <!--T:1-->
The most important classes for inventory management are:
The most important classes for inventory management are:
* InventoryManager:  Contains multiple inventories (every player has one with different inventories). Also helps with common tasks like putting items into a valid inventory.
* InventoryManager:  Contains multiple inventories (every player has one with different inventories). Also helps with common tasks like putting items into a valid inventory.
Line 8: Line 8:
* ItemStack: Contains the Item and amount of items (called StackSize), e.g. "block torch-up" and StackSize of 2, for two Torches.
* ItemStack: Contains the Item and amount of items (called StackSize), e.g. "block torch-up" and StackSize of 2, for two Torches.


== Basic Inventory Handling ==
== Basic Inventory Handling == <!--T:2-->


<!--T:3-->
To get access to a players inventory, you can use the InventoryManager of the IPlayer. For example, to simply give the player a torch when respawning you could use <code>TryGiveItemStack</code>:
To get access to a players inventory, you can use the InventoryManager of the IPlayer. For example, to simply give the player a torch when respawning you could use <code>TryGiveItemStack</code>:
</translate>
</translate>
Confirmedusers
13,514

edits