Jump to content

How to check items in a shulker the player is holding.


WolfxOmega

Recommended Posts

I am trying to make a skript that checks if a player has a certain item in a shulker that the player is holding but I don't know how I would go about checking for the items in the shulker. I added an if statement that checks if the player is holding a shulker but I don't know what else to do.

Link to comment
Share on other sites

I'm not sure how to do this, but here's a function that might do the trick. I haven't tested it though.

function check_shulkers(p: player, i: item) :: boolean:
	if {_p} is holding a shulker box:
		loop (held item of {_p})'s inventory:
			if loop-value is {_i}:
				return true
		return false

To call the function, just do:

check_shulker(player, item)

# Player is the player whos inventory you wanna check.

# Item is the item that you'll check if inside the shulker box.

The function will then return `false` or `true` whether or not the item is inside the held shulker box.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...