Skip to content

Class "PocketItem"⚓︎

Info

你可以通过以下函数获取此类:

Example Code
1
local pocket = Isaac.GetPlayer(0):GetPocketItem(0)

Functions⚓︎

GetSlot ()⚓︎

int GetSlot ( )⚓︎

local pocketItem = player:GetPocketItem(PillCardSlot.PRIMARY) For pills, returns PillColor. if pocketItem:GetType() == PocketItemType.ACTIVE_ITEM then For pocket active items, returns the corresponding ActiveSlot+1 (so ActiveSlot.SLOT_POCKET + 1 or ActiveSlot.SLOT_POCKET2 + 1). Returns an identifying value for this pocket item. Varies depending on the PocketItemType. local activeItemID = player:GetActiveItem(activeSlot) end Returns 0 if the pocket slot is empty. For cards, returns Card.

1
2
???+ example "Example code to obtain the [CollectibleType](https://wofsauge.github.io/IsaacDocs/rep/enums/CollectibleType.html) of the pocket active item in a given pocket slot:"
local activeSlot = pocketItem:GetSlot() - 1

GetType ()⚓︎

PocketItemType GetType ( )⚓︎

This value is unreliable if the slot is currently empty, as the game sometimes does not clear it. Returns the PocketItemType.