UNPKG

@bedrock-apis/nbt-core

Version:

Shared Types and minimal code for NBT packages

88 lines (86 loc) 1.99 kB
//#region core/tag-type.ts let TagType = /* @__PURE__ */ function(TagType$1) { TagType$1[TagType$1["EndOfCompound"] = 0] = "EndOfCompound"; TagType$1[TagType$1["Byte"] = 1] = "Byte"; TagType$1[TagType$1["Short"] = 2] = "Short"; TagType$1[TagType$1["Int"] = 3] = "Int"; TagType$1[TagType$1["Long"] = 4] = "Long"; TagType$1[TagType$1["Float"] = 5] = "Float"; TagType$1[TagType$1["Double"] = 6] = "Double"; TagType$1[TagType$1["ByteArray"] = 7] = "ByteArray"; TagType$1[TagType$1["String"] = 8] = "String"; TagType$1[TagType$1["List"] = 9] = "List"; TagType$1[TagType$1["Compound"] = 10] = "Compound"; TagType$1[TagType$1["IntArray"] = 11] = "IntArray"; TagType$1[TagType$1["LongArray"] = 12] = "LongArray"; return TagType$1; }({}); //#endregion //#region core/types.ts var Byte = class extends Number { static internalTagType; }; var Short = class extends Number { static internalTagType; }; var Int = class extends Number { static internalTagType; }; var Float = class extends Number { static internalTagType; }; var Double = class extends Number { static internalTagType; }; var Long = class { static internalTagType; constructor(value) { this.value = value; } valueOf() { return this.value; } }; { const impls = [ Byte, Short, Int, Long, Float, Double, String, Array, Uint8Array, Int32Array, BigInt64Array, Object ]; const types = [ TagType.Byte, TagType.Short, TagType.Int, TagType.Long, TagType.Float, TagType.Double, TagType.String, TagType.List, TagType.ByteArray, TagType.IntArray, TagType.LongArray, TagType.Compound ]; for (let i = 0; i < impls.length; i++) { const type = impls[i]; const property = { enumerable: false, configurable: true, writable: true, value: types[i] }; Reflect.defineProperty(type, "internalTagType", property); Reflect.defineProperty(type.prototype, "internalTagType", property); } } //#endregion export { Byte, Double, Float, Int, Long, Short, TagType };