Skip to content

Commit

Permalink
update items builder version v16
Browse files Browse the repository at this point in the history
  • Loading branch information
JadlionHD committed Dec 27, 2023
1 parent bf9f485 commit 002c0f0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "growtopia.js",
"version": "1.3.1",
"version": "1.3.2",
"description": "A package to create a growtopia private servers.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
4 changes: 4 additions & 0 deletions src/structures/ItemsDat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,10 @@ class ItemsDat {
this.mempos += 25;
item.extraTexture = await this.readString({ id: item.id });
}

if (meta.version! >= 16) {
item.itemRenderer = await this.readString({ id: item.id });
}
}

meta.items.push(item);
Expand Down
14 changes: 14 additions & 0 deletions test/items-builder-v16/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const fs = require("fs");
const { ItemsDat } = require("../../dist");

const file = fs.readFileSync("./test/items-builder-v16/items.dat");

const item = new ItemsDat(file);

(async () => {
const decoded = await item.decode();

decoded.items.forEach((i) => {
i.itemRenderer.length ? console.log(i) : undefined;
});
})();
Binary file added test/items-builder-v16/items.dat
Binary file not shown.
1 change: 1 addition & 0 deletions types/items.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export interface ItemDefinition {
bodyPart?: Buffer;
flags5?: number;
extraTexture?: string;
itemRenderer?: string;
}

export interface ItemsDatMeta {
Expand Down

0 comments on commit 002c0f0

Please sign in to comment.