Update Minecraft recipebook with more recipes

This commit is contained in:
Andrew Miner
2015-01-01 11:06:25 -08:00
parent 57c6cca436
commit a265383630
18 changed files with 2093 additions and 1127 deletions
+9 -9
View File
@@ -1,8 +1,8 @@
###
# Crafting Guide - recipe.coffee
#
# Copyright (c) 2014 by Redwood Labs
# All rights reserved.
Crafting Guide - recipe.coffee
Copyright (c) 2014 by Redwood Labs
All rights reserved.
###
BaseModel = require './base_model'
@@ -13,11 +13,11 @@ module.exports = class Recipe extends BaseModel
constructor: (attributes={}, options={})->
if not attributes.output? then throw new Error "attributes.output is required"
if not attributes.input? then throw new Error "attributes.input is required"
attributes.input ?= []
attributes.tools ?= []
super attributes, options
Object.defineProperty this, 'name', get:-> @output[0].name
Object.defineProperty @prototype, 'name', get:-> @output[0].name
# Public Methods ###############################################################################
@@ -45,7 +45,7 @@ module.exports = class Recipe extends BaseModel
for inputItem in @input
if needsDelimiter then result.push ', '
result.push inputItem.toString()
needsDelimiter = false
needsDelimiter = true
result.push ']'
result.push ", output:["
@@ -53,7 +53,7 @@ module.exports = class Recipe extends BaseModel
for outputItem in @output
if needsDelimiter then result.push ', '
result.push outputItem.toString()
needsDelimiter = false
needsDelimiter = true
result.push ']'
if @tools.length > 0
@@ -62,7 +62,7 @@ module.exports = class Recipe extends BaseModel
for tool in @tools
if needsDelimiter then result.push ', '
result.push tool.toString()
needsDelimiter = false
needsDelimiter = true
result.push ']'
result.push '}'