Skip to content

Commit

Permalink
Only create ChestDialog if game.isClient
Browse files Browse the repository at this point in the history
  • Loading branch information
deathcap committed Jan 20, 2014
1 parent 438cb7e commit 20fd3e8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 8 additions & 6 deletions index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,21 @@ 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()

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([
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 20fd3e8

Please sign in to comment.