Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
2.4 kB
17
Indexable
Never
		

function invOpen(p: player, size: integer, name: object, tag: object, animation: integer):
	{inventoryopen::%uuid of {_p}%} isn't true
	set metadata tag {_tag} of {_p} to chest inventory with {_size} rows named "%{_name}%"
	open (metadata tag {_tag} of {_p}) to {_p}
	set {inventoryopen::%uuid of {_p}%} to true
	set {_n} to 0
	loop 9 times:
		if {_size} = 3:
			set slot {_n} of metadata tag {_tag} of {_p} to gray stained glass pane named " "
			add 9 to {_n}
			set slot {_n} of metadata tag {_tag} of {_p} to gray stained glass pane named " "
			add 9 to {_n}
			set slot {_n} of metadata tag {_tag} of {_p} to gray stained glass pane named " "
			remove 17 from {_n}
		else if {_size} = 5:
			set slot {_n} of metadata tag {_tag} of {_p} to gray stained glass pane named " "
			add 9 to {_n}
			set slot {_n} of metadata tag {_tag} of {_p} to gray stained glass pane named " "
			add 9 to {_n}
			set slot {_n} of metadata tag {_tag} of {_p} to gray stained glass pane named " "
			add 9 to {_n}
			set slot {_n} of metadata tag {_tag} of {_p} to gray stained glass pane named " "
			add 9 to {_n}
			set slot {_n} of metadata tag {_tag} of {_p} to gray stained glass pane named " "
			remove 35 from {_n}
		else if {_size} = 6:
			set slot {_n} of metadata tag {_tag} of {_p} to gray stained glass pane named " "
			add 9 to {_n}
			set slot {_n} of metadata tag {_tag} of {_p} to gray stained glass pane named " "
			add 9 to {_n}
			set slot {_n} of metadata tag {_tag} of {_p} to gray stained glass pane named " "
			add 9 to {_n}
			set slot {_n} of metadata tag {_tag} of {_p} to gray stained glass pane named " "
			add 9 to {_n}
			set slot {_n} of metadata tag {_tag} of {_p} to gray stained glass pane named " "
			add 9 to {_n}
			set slot {_n} of metadata tag {_tag} of {_p} to gray stained glass pane named " "
			remove 44 from {_n}
		if {_animation} = 1:
			wait 1 tick
			play sound "block.calcite.break" with pitch -2 to {_p} if {inventoryopen::%uuid of {_p}%} is true
	wait 1 tick
	play sound "block.note_block.bell" to {_p} if {inventoryopen::%uuid of {_p}%} is true
	wait 1 tick
	clear {inventoryopen::%uuid of {_p}%}
on inventory close:
	if {inventoryopen::%uuid of player%} is true:
		wait 12 ticks
		clear {inventoryopen::%uuid of player%}

#ex:
# invOpen(player, 3, "&8YOOO", "yo", 1)
# invOpen(player, size, name, tag, anim (1,0))
Leave a Comment