UNPKG

@minecraft/creator-tools

Version:

Minecraft Creator Tools command line and libraries.

27 lines (25 loc) 836 B
"use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", { value: true }); class Varint { constructor(incomingBytes, startingIndex) { this.byteLength = 0; this.value = 0; this.fileBytes = incomingBytes; this.startIndex = startingIndex; let i = 0; while (this.fileBytes[this.startIndex + i] >= 128 && this.startIndex + i < incomingBytes.length) { i++; } this.byteLength = i + 1; this.value = this.fileBytes[this.startIndex + i]; while (i > 0) { this.value *= 128; this.value += this.fileBytes[this.startIndex + i - 1] - 128; i--; } } } exports.default = Varint; //# sourceMappingURL=../maps/minecraft/Varint.js.map