cc-mc-server/mc/chunk.lua

28 lines
515 B
Lua
Raw Normal View History

2024-07-12 16:58:47 +01:00
local util = require("util")
local nibbleArray = require("nibbleArray")
local MAX_HEIGHT = 128
local chunk = {}
local defaultsTable = {
blocks = {}
}
function chunk:new()
local newTable = util.deepCopyTable(defaultsTable) or {}
local blockBufferSize = 16 * 16 * MAX_HEIGHT
for i = 1, blockBufferSize do
table.insert(newTable.blocks, 0)
end
print(#newTable.blocks)
-- Set this table as this """class"""'s metatable
setmetatable(newTable, self)
self.__index = self
return newTable
end
return chunk