Hello everyone !
First post for me, be indulgent haha
I explain my problem to you:
On my Minecraft server I want to create a system of safes chest when you click on a particular block (here end stone to start). There will be a whole system of access for certain players who own the chest and non-access for other players with unlocking systems. Here's for context. However, to begin with, I can't seem to get these virtual chests created, I don't know how to save the inventories. I had thought about playing with location variables (because the safes once placed cannot be moved, but what I did does not work. I am attaching the code (which may be wrong from A to Z . If you could direct me that would be great! Thanks in advance
Excuse my bad english
First post for me, be indulgent haha
I explain my problem to you:
On my Minecraft server I want to create a system of safes chest when you click on a particular block (here end stone to start). There will be a whole system of access for certain players who own the chest and non-access for other players with unlocking systems. Here's for context. However, to begin with, I can't seem to get these virtual chests created, I don't know how to save the inventories. I had thought about playing with location variables (because the safes once placed cannot be moved, but what I did does not work. I am attaching the code (which may be wrong from A to Z . If you could direct me that would be great! Thanks in advance
Excuse my bad english
Code:
options:
Coffre1: Coffre niveau 1
function restoreCoffre(inv: inventory, player: player, loc: location):
loop chest size of {_inv} times:
set slot loop-number -1 of {_inv} to {Coffre::p::%{_player}%::%{_loc}%::Items::%loop-number%}
clear {Coffre::p::%{_player}%::%{_loc}%::Items::*}
function saveCoffre(inv: inventory, player: player, loc: location):
clear {Coffre::p::%{_player}%::%{_loc}%::Items::*}
loop chest size of {_inv} times:
add slot loop-number -1 of {_inv} to {Coffre::p::%{_player}%::%{_loc}%::Items::*}
clear {Coffre::p::%{_player}%::loc::Inv}
on inventory close:
set {_inv} to event-inventory
set {_loc} to event-location
if {_inv} is {Coffre::p::%player%::%event-location%::Inv}:
saveCoffre({_inv}, player, {_loc})
on right click on end stone:
set {_inv} to chest with 1 row named "{@Coffre1}"
set {_loc} to event-location
set {Coffre::p::%player%::loc::Inv} to {_inv}
restoreCoffre({_inv}, player, {_loc})
open {_inv} for player