From f40689ee3554d3988f2e352dd0c9a3b9b6d40543 Mon Sep 17 00:00:00 2001 From: deathcap Date: Mon, 20 Jan 2014 09:15:10 -0800 Subject: [PATCH] Only create WorkbenchDialog if game.isClient Ref https://github.com/deathcap/voxpopuli/issues/26 --- index.coffee | 12 +++++++----- index.js | 4 +++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/index.coffee b/index.coffee index de00d4b..6f0f724 100644 --- a/index.coffee +++ b/index.coffee @@ -22,8 +22,9 @@ class Workbench opts.registerBlock ?= true opts.registerRecipe ?= true - - @workbenchDialog = new WorkbenchDialog(game, @playerInventory, @registry, @recipes) + + if @game.isClient + @workbenchDialog = new WorkbenchDialog(game, @playerInventory, @registry, @recipes) @opts = opts @enable() @@ -31,9 +32,10 @@ class Workbench enable: () -> if @opts.registerBlock @registry.registerBlock 'workbench', {texture: ['crafting_table_top', 'planks_oak', 'crafting_table_side'], onInteract: () => - @workbenchDialog.open() - true - } + # TODO: server-side + @workbenchDialog.open() + true + } if @opts.registerRecipe @recipes.register new AmorphousRecipe(['wood.plank', 'wood.plank', 'wood.plank', 'wood.plank'], new ItemPile('workbench', 1)) diff --git a/index.js b/index.js index 92bf051..01d0de9 100644 --- a/index.js +++ b/index.js @@ -59,7 +59,9 @@ if (opts.registerRecipe == null) { opts.registerRecipe = true; } - this.workbenchDialog = new WorkbenchDialog(game, this.playerInventory, this.registry, this.recipes); + if (this.game.isClient) { + this.workbenchDialog = new WorkbenchDialog(game, this.playerInventory, this.registry, this.recipes); + } this.opts = opts; this.enable(); }