Skip to content

Commit

Permalink
Only create WorkbenchDialog if game.isClient
Browse files Browse the repository at this point in the history
  • Loading branch information
deathcap committed Jan 20, 2014
1 parent f4bacf0 commit f40689e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 7 additions & 5 deletions index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,20 @@ 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()

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))
Expand Down
4 changes: 3 additions & 1 deletion index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f40689e

Please sign in to comment.