PMP Protobuf is a helper library for the PMP (PenguinMod Project) format and its protobuf counterpart, which is used in the PenguinMod backend.
Use NPM:
npm install pmp-protobufimport { jsonToProtobuf } from "pmp-protobuf';
const json = /* get the project.json from somewhere... */;
// this will be a Uint8Array
const protobuf = jsonToProtobuf(json);import { protobufToJson } from "pmp-protobuf';
const protobuf = /* get the protobuf from somewhere (probably the API)... */;
// this will be an object
const json = protobufToJson(protobuf);import { protobufToPMP } from "pmp-protobuf';
const protobuf = /* get the protobuf from somewhere (probably the API)... */;
const assets = /* get these from somewhere (probably also the API)... */;
// this will be in the PMP format; it will be an ArrayBuffer.
const pmp = await protobufToPMP(protobuf, assets);import { jsonToPMP } from "pmp-protobuf';
const json = /* get the json from somewhere (probably the VM)... */;
const assets = /* get these from somewhere (probably also the VM)... */;
// this will be in the PMP format; it will be an ArrayBuffer.
const pmp = await jsonToPMP(protobuf, assets);node_modules/.bin/pbjs --keep-case protobufs/project.proto protobufs/sprite.proto > protobuf-bundle.json