From aed8c401ac4e41785754d328797be32dd5317176 Mon Sep 17 00:00:00 2001 From: LabyStudio Date: Fri, 13 May 2022 21:46:55 +0200 Subject: [PATCH] remove previous canvas elements --- src/js/net/minecraft/client/GameWindow.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/js/net/minecraft/client/GameWindow.js b/src/js/net/minecraft/client/GameWindow.js index 67cc982..1af808b 100644 --- a/src/js/net/minecraft/client/GameWindow.js +++ b/src/js/net/minecraft/client/GameWindow.js @@ -18,6 +18,11 @@ export default class GameWindow { // Get canvas wrapper this.wrapper = document.getElementById(this.canvasWrapperId); + // Remove all children of wrapper + while (this.wrapper.firstChild) { + this.wrapper.removeChild(this.wrapper.firstChild); + } + // Create world renderer this.canvas = document.createElement('canvas'); this.wrapper.appendChild(this.canvas);