-- Config start local keybind = 3 -- https://www.glfw.org/docs/latest/group__keys.html https://www.glfw.org/docs/3.3/group__buttons.html local delay = 1 -- Config end local player = require("player") local world = require('world') local inventory = {} function inventory.findItemInHotbar(id) for slot = 0, 8 do local item = player.inventory.getStack(slot) if item and item.skyblock_id and string.find(item.skyblock_id, id) then return slot end end return nil end local toggled = false local tick = 0 local prev_slot = nil local tick_wait = 0 registerKeyEvent(function(key, action) if action == "Release" and key == keybind then player.input.setSelectedSlot(prev_slot) prev_slot = nil tick_wait = 0 player.input.setPressedAttack(false) toggled = false elseif action == "Press" and key == keybind then local item = inventory.findItemInHotbar("DUNGEONBREAKER") if item then prev_slot = player.input.getSelectedSlot() player.input.setSelectedSlot(item) end toggled = true end end) registerClientTick(function() if toggled then if tick <= 0 then local item = inventory.findItemInHotbar("DUNGEONBREAKER") local raycastResult = player.raycast(4.5) if raycastResult == nil then return 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.name == "block.minecraft.chest" or block.name == "block.minecraft.player_head" or block.name == "block.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.setPressedAttack(false) return end end end if item then player.input.setPressedAttack(true) tick = delay end else tick = tick - 1 end end end)