How do you get event-inventory's location in the inventory open event?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Felnstaren

Member
Feb 18, 2019
2
0
0
21
Title basically explains the question. How would I get the location of the opened inventory in the "on inventory open" event? (People who have never touched spigot, what I mean is the location of the block that owns the opened inventory)

Example of what i'm looking for:
Code:
on inventory open:
 send "inventory"

 if event-inventory's name is "Tier I":
  send "Tier I"
  send "%event-inventory's-location%"
  make console execute command "/setblock %event-inventory's location% minecraft:chest 2 replace {LootTable:'chests/simple_dungeon'}"

Note: %event-location% and %location% only return the player's location. I also need it to return a raw xyz location for the command to work, so the command should look more like
"/setblock %event-inventory's-x-location% %event-inventory's-y-location% %event-inventory's-z-location% chest"

If someone knows how to set blocks using json tags ({LootTable:'chests/simple_dungeon'} in particular) using skript instead of using commands, that would be sufficient as well.
 
Last edited:
Maybe try using the targeted block of player (or blocks around it to deal with lag), and check if those blocks inventory is the event-inventory
EDIT: Inventory holder could also return the block:
ZrzzLKW.png
(I know this is from Spigot but Skript probably uses this method)
EDIT 2: seems that this will be available & working in the next release: https://github.com/SkriptLang/Skript/commit/3a2b0fccd31af904e9708438fd3106ff95103ae4
 
Last edited:
Status
Not open for further replies.