Skip to content

Inventory Component Helper page

PeterOu8 edited this page Oct 3, 2022 · 3 revisions

How to use inventory methods

In order to add an item to the player's inventory. Firstly, get the current player Entity using:

ServiceLocator.getGameArea().getPlayer();

Then, get the inventory component of the player.
ServiceLocator.getGameArea().getPlayer().getComponent(InventoryComponent.class);

This should return you the InventoryComponent class. Now you can use any function in the inventory.

Adding and removing items

Back to Inventory Page

Author

  • Li-Sung Ou
  • GitHub: @PeterOu8
  • Discord: Secret Agent Randy Beans#6754
  • Slack: Li-Sung Ou
Clone this wiki locally