Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Schematic API
- -- by MysticT
- function load(sPath)
- local tags, err = nbt.readNBTFile(sPath)
- if tags == nil then
- return nil, err
- end
- if tags[1].name ~= "Schematic" then
- return nil, "Not an schematic file"
- end
- return tags[1].payload
- end
- function getBlocks(schem)
- local blocks, data
- for _,tag in ipairs(schem) do
- if tag.name == "Blocks" then
- blocks = tag.payload
- elseif tag.name == "Data" then
- data = tag.payload
- end
- end
- return blocks, data
- end
- function getSize(schem)
- local width, height, length
- for _,tag in ipairs(schem) do
- if tag.name == "Width" then
- width = tag.payload
- elseif tag.name == "Height" then
- height = tag.payload
- elseif tag.name == "Length" then
- length = tag.payload
- end
- end
- return width, height, length
- end
- function getMaterials(schem)
- for _,tag in ipairs(schem) do
- if tag.name == "Materials" then
- return tag.payload
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement