diff --git a/index.coffee b/index.coffee index 90d97ff..87e060c 100644 --- a/index.coffee +++ b/index.coffee @@ -19,8 +19,9 @@ class Chest opts.registerBlock ?= @registry? opts.registerRecipe ?= @recipes? - - @chestDialog = new ChestDialog(game, @playerInventory, @registry, @blockdata) + + if @game.isClient + @chestDialog = new ChestDialog(game, @playerInventory, @registry, @blockdata) @opts = opts @enable() @@ -28,10 +29,11 @@ class Chest enable: () -> if @opts.registerBlock # TODO: chest textures? not in current tp.. - @registry.registerBlock 'chest', {texture: ['door_wood_lower', 'piston_top_normal', 'bookshelf'], onInteract: (target) => - @chestDialog.open(target) - true - } + @registry.registerBlock 'chest', {texture: ['door_wood_lower', 'piston_top_normal', 'bookshelf'], onInteract: (target) => + # TODO: server-side? + @chestDialog.open(target) + true + } if @opts.registerRecipe @recipes.register new PositionalRecipe([ diff --git a/index.js b/index.js index 1897460..27424c4 100644 --- a/index.js +++ b/index.js @@ -43,7 +43,9 @@ if (opts.registerRecipe == null) { opts.registerRecipe = this.recipes != null; } - this.chestDialog = new ChestDialog(game, this.playerInventory, this.registry, this.blockdata); + if (this.game.isClient) { + this.chestDialog = new ChestDialog(game, this.playerInventory, this.registry, this.blockdata); + } this.opts = opts; this.enable(); }