-
Notifications
You must be signed in to change notification settings - Fork 1
Inventory Component Helper page
PeterOu8 edited this page Oct 3, 2022
·
3 revisions
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.
- Li-Sung Ou
- GitHub: @PeterOu8
- Discord: Secret Agent Randy Beans#6754
- Slack: Li-Sung Ou