model formats (mca..x3d): comments are specs only

This commit is contained in:
4DBug committed 2026-11-01 01:54:32 -05:00
1 parent 0bd7b87d2b
commit b952c10222
49 files changed
+310 -936

No files matched your search

+3 -7
View File
@@ -1,8 +1,7 @@
--!strict
-- model/schematic/Sponge: the Sponge schematic format (.schem: WorldEdit 7+, FAWE, Amulet), from the
-- SpongePowered/Schematic-Specification documents for versions 1, 2 and 3: Width / Height / Length, Offset, the
-- block-state Palette with varint BlockData (v1 / v2) or the Blocks container (v3), block entities (TileEntities /
-- BlockEntities, v3 with Data), Entities, Metadata, DataVersion; biomes are kept as they are.
-- model/schematic/Sponge: .schem (WorldEdit 7+, FAWE, Amulet), from SpongePowered/Schematic-Specification v1-3: Width /
-- Height / Length, Offset, Palette with varint BlockData (v1 / v2) or the Blocks container (v3), block entities
-- (TileEntities / BlockEntities, v3 with Data), Entities, Metadata, DataVersion; biomes are kept as they are.
local Types = require("@rosetta/Types")
local Nbt = require("@rosetta/codecs/text/Nbt")
local Mc = require("@rosetta/codecs/model/Minecraft")
@@ -12,7 +11,6 @@ local Sponge = {}
local Packed = Mc.Packed
-- read(s, maxCells) -> { Region }, extra | nil, message. s: the Schematic compound (v3: the root's Schematic child)
function Sponge.read(s: any, maxCells: number): ({ Common.Region }?, any)
local version = Common.int(s.Version) or 1
local function u16(v: any): any
@@ -81,8 +79,6 @@ function Sponge.read(s: any, maxCells: number): ({ Common.Region }?, any)
return regions, { version = version, dataVersion = Common.int(s.DataVersion), metadata = s.Metadata }
end
-- write(region, version, dataVersion, base?) -> the Schematic compound (v3: the caller wraps it in the root) | nil,
-- message. base: the decoded Schematic compound whose other fields (Metadata, Biomes, ...) are kept
function Sponge.write(r: Common.Region, version: number, dataVersion: number, base: any): (any, string?)
local sx, sy, sz = r.size[1], r.size[2], r.size[3]
if sx > 65535 or sy > 65535 or sz > 65535 then