%loadEvent block-click; %setVar closed true; @wait %wait; %if $block-loc == rpg:-52:68:-54 goto close; %if $block-loc == rpg:-57:68:-54 goto open; %goto wait; @close %if $closed == true goto wait; %setVar closed true; %setBlock rpg:-56:69:-56 IRON_FENCE; %setBlock rpg:-55:69:-56 IRON_FENCE; %setBlock rpg:-54:69:-56 IRON_FENCE; %setBlock rpg:-53:69:-56 IRON_FENCE; %playSound rpg:-55:68:-56 BLOCK_ANVIL_LAND; %waitfor 10; %setBlock rpg:-56:68:-56 IRON_FENCE; %setBlock rpg:-55:68:-56 IRON_FENCE; %setBlock rpg:-54:68:-56 IRON_FENCE; %setBlock rpg:-53:68:-56 IRON_FENCE; %playSound rpg:-55:68:-56 BLOCK_ANVIL_LAND; %waitfor 10; %setBlock rpg:-56:67:-56 IRON_FENCE; %setBlock rpg:-55:67:-56 IRON_FENCE; %setBlock rpg:-54:67:-56 IRON_FENCE; %setBlock rpg:-53:67:-56 IRON_FENCE; %playSound rpg:-55:68:-56 BLOCK_ANVIL_LAND; %goto wait; @open %if $closed == false goto wait; %setVar closed false; %setBlock rpg:-56:67:-56 AIR; %setBlock rpg:-55:67:-56 AIR; %setBlock rpg:-54:67:-56 AIR; %setBlock rpg:-53:67:-56 AIR; %playSound rpg:-55:68:-56 BLOCK_CHEST_OPEN; %waitfor 10; %setBlock rpg:-56:68:-56 AIR; %setBlock rpg:-55:68:-56 AIR; %setBlock rpg:-54:68:-56 AIR; %setBlock rpg:-53:68:-56 AIR; %playSound rpg:-55:68:-56 BLOCK_CHEST_OPEN; %waitfor 10; %setBlock rpg:-56:69:-56 AIR; %setBlock rpg:-55:69:-56 AIR; %setBlock rpg:-54:69:-56 AIR; %setBlock rpg:-53:69:-56 AIR; %playSound rpg:-55:68:-56 BLOCK_CHEST_OPEN; %goto wait;