KubeJS

KubeJS

69M Downloads

is there a way to check if there is a specific item in the player's inventory?

SamukaDEV opened this issue ยท 3 comments

commented

image

explaining: i want to access this items without open a chest to do it!

image

i have accessed the ivnentory, but in a chest! i want to find items without open a chest, when i hit "E" or something like!

commented

more comprehensive documentation would be very interesting, I can't find many doubts that I find about methods and properties of events and functions, I would love new content in the documentation.

commented

Use the player.inventory.xxxx events.

For the change event, entity / item / slot will tell you about the change.

For opening or closing an inventory, entity / inventoryContainer are available. inventoryContainer is a PlayerContainer from the Forge API, not a KubeJS wrapper, so it could break in future versions of the Forge API, Minecraft, etc. You probably want the inventorySlots property.

For better documentation, read the source code like this and update the wiki.

commented

Actually, a better approach would be to call event . player . inventory and then do what you want.