From 2298bf7c22de28a5470738530f55b6d067fce0e4 Mon Sep 17 00:00:00 2001 From: Nic Becker Date: Sat, 14 Sep 2024 17:37:22 -0700 Subject: [PATCH 1/3] use node-canvas --- viewer/lib/entities.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/viewer/lib/entities.js b/viewer/lib/entities.js index 660a3244..88dc824d 100644 --- a/viewer/lib/entities.js +++ b/viewer/lib/entities.js @@ -4,15 +4,19 @@ const TWEEN = require('@tweenjs/tween.js') const Entity = require('./entity/Entity') const { dispose3 } = require('./dispose') +const { createCanvas } = require('canvas') + function getEntityMesh (entity, scene) { if (entity.name) { try { const e = new Entity('1.16.4', entity.name, scene) if (entity.username !== undefined) { - const canvas = document.createElement('canvas') - canvas.width = 500 - canvas.height = 100 + // Referencing document breaks headless + // const canvas = document.createElement('canvas') + // canvas.width = 500 + // canvas.height = 100 + const canvas = createCanvas(500, 100) const ctx = canvas.getContext('2d') ctx.font = '50pt Arial' From a8d3a3f35da9948fa3c55ea9fedc850677f3b2b1 Mon Sep 17 00:00:00 2001 From: Nic Becker Date: Sat, 14 Sep 2024 17:43:12 -0700 Subject: [PATCH 2/3] remove invisible_cape from player --- viewer/lib/entity/entities.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/viewer/lib/entity/entities.json b/viewer/lib/entity/entities.json index f005f5d1..7ab91d54 100644 --- a/viewer/lib/entity/entities.json +++ b/viewer/lib/entity/entities.json @@ -11192,8 +11192,7 @@ "animated": "player_animated" }, "textures": { - "default": "textures/entity/steve", - "cape": "textures/entity/cape_invisible" + "default": "textures/entity/steve" }, "geometry": { "default": { From ce30cd90949d6d58a897a141934ebd856333c441 Mon Sep 17 00:00:00 2001 From: Nic Becker Date: Sat, 14 Sep 2024 19:11:30 -0700 Subject: [PATCH 3/3] clean up --- viewer/lib/entities.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/viewer/lib/entities.js b/viewer/lib/entities.js index 88dc824d..459e3f36 100644 --- a/viewer/lib/entities.js +++ b/viewer/lib/entities.js @@ -12,10 +12,6 @@ function getEntityMesh (entity, scene) { const e = new Entity('1.16.4', entity.name, scene) if (entity.username !== undefined) { - // Referencing document breaks headless - // const canvas = document.createElement('canvas') - // canvas.width = 500 - // canvas.height = 100 const canvas = createCanvas(500, 100) const ctx = canvas.getContext('2d')