I really like the scripting possibilities of this mod, but I'm missing something like a "Scripted Chest" or at least a "setContainer(int size)" method for the "Scripted Block". I was trying to script a workaround with a chest nearby, but I failed because of not knowing how to show the chest's GUI or to create a high dynamic dialog.
function interact(event) {
var container = event.block.world.getBlock(event.block.getX(), event.block.getY()-1, event.block.getZ()).getContainer();
var tempDialog = new IDialog(); // <-- This don't work - need something similar
var dialogText = "Content:";
for (i=0; i<container.getSize(); i++) {
if(container.getSlot(i) && container.getSlot(i).getName() != "minecraft:air") {
dialogText += container.getSlot(i).getDisplayName() + " x" + container.getSlot(i).getStackSize();
}
}
tempDialog.setText(dialogText);
// setting DialogOptions here to get some or all items
event.player.showDialog(tempDialog);
}
The final idea behind this is to put player dependent content in chests. For example a Player who has finished Quest 1 can find a wooden sword, wood coins or leather armor in a chest, while another player, who has finished Quest 27 can find diamond equipment inside the same chest.
Another reason for wanting a Scripted Chest is to want locked chests. I made a working (un)locking script for "Scripted Doors" and it would be really nice, if I could use a similar one for chests too.
Has anyone a solution?
Edit:
It seems I think too complicated. Two simple lines like these...
var containerBlock = event.target.getWorld().getBlock(event.target.getX(), event.target.getY()-1, event.target.getZ());
PlayerEvent.InteractEvent(event.player, event.type, containerBlock);
... should let me directly interact with the chest, isn't it? Unfortunatly neither PlayerEvent nor InteractEvent are defined. Has anyone another idea?