local last={ x=0, y=0, z=0 } local player = require('player') local world = require('world') registerClientTick(function() local location = player.getLocation() if location == "DUNGEON" and player.inventory.isAnyScreenOpened() then local title = player.inventory.getChestTitle() if title then if title == 'Chest' then player.inventory.closeScreen() end end end local raycastResult = player.raycast(4.5) if raycastResult == nil then print("MISS") else local resultType = raycastResult.type if resultType == "block" then local block = world.getBlock(raycastResult.blockPos.x, raycastResult.blockPos.y, raycastResult.blockPos.z) if block and (block.identifier == "minecraft:chest" or block.identifier == "minecraft:player_head" or block.identifier == "minecraft:lever") and location == "DUNGEON" and (last.x ~= raycastResult.blockPos.x or last.y ~= raycastResult.blockPos.y or last.z ~= raycastResult.blockPos.z) then player.input.interactBlock(raycastResult) last.x = raycastResult.blockPos.x last.y = raycastResult.blockPos.y last.z = raycastResult.blockPos.z end end end end)