Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------------------------
- -- /lib/MinecraftGetter
- -------------------------------
- --- This package keeps all functions that are getting data from minecraft:
- -- get player location, getting scoreboard data, ...
- -- the rest of twenty-k code should not use Minecraft commands directly but only through this package
- local mc = {}
- mcget = mc
- --- Returns a table with the coordinates of the computer running this script
- function mc.computerPosition()
- local ox,oy,oz = commands.getBlockPosition()
- local T = {
- x = ox,
- y = oy,
- z = oz
- }
- return T
- end
- --- Checks if a specified block is at the specified locaiton
- -- block can be passed as table with .block and .variant
- -- or as a string for testing for block kind of all its variants
- function mc.testForBlock(x,y,z,block)
- local isblock = false
- local message
- if type(block) == 'table' then
- isblock, message = commands.testforblock(x,y,z,block.block,block.variant)
- elseif type(block) == 'string' then
- isblock, message = commands.testforblock(x,y,z,block)
- end
- --debug.log("commands.testforblock returned: isblock >"..isblock.."<, message >"..message.."<")
- return isblock
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement