From 162962a5454fe643a1aecb34712a4c49fec9ac58 Mon Sep 17 00:00:00 2001 From: DDShadowRU Date: Tue, 17 Jul 2018 17:41:49 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B5=D0=BD=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=B4=20=D1=80=D0=B5=D0=B3=D0=B8=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8=20=D0=B1=D0=BE=D1=87=D0=B5=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dev/shared.js | 1 + dev/storage/items/crates.js | 83 ++++++++++++++++++------------------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/dev/shared.js b/dev/shared.js index 6aa6a4b..f4e8104 100644 --- a/dev/shared.js +++ b/dev/shared.js @@ -31,6 +31,7 @@ ModAPI.registerAPI("ForestryAPI", { generateOre: generateOre, registerLiquidContainer: registerLiquidContainer, pickupLiquidFromWorld: pickupLiquidFromWorld, + registerCrate: registerCrate, requireGlobal: function (command) { return eval(command); diff --git a/dev/storage/items/crates.js b/dev/storage/items/crates.js index f518fd6..9e600b4 100644 --- a/dev/storage/items/crates.js +++ b/dev/storage/items/crates.js @@ -1,48 +1,49 @@ -if (ForestryConfig.crateEnabled === true) { - IDRegistry.genItemID("crate"); - Item.createItem("crate", "Crate", {name: "crate", meta: 0}, {}); +IDRegistry.genItemID("crate"); +Item.createItem("crate", "Crate", {name: "crate", meta: 0}, {}); - function registerCrate(id, n, texture, d) { - let name = id; - let data = d ? d : 0; - IDRegistry.genItemID("crate" + name); - Item.createItem("crate" + name, "Crate (" + n + ")", {name: texture, meta: 0}, {}); +function registerCrate(id, itemName, texture, data) { + data = data || 0; + let crateId = "crate" + id + "_" + data; - CarpenterManager.registerRecipe({ - input: { - "slot0": {id: id, data: data}, "slot1": {id: id, data: data}, "slot2": {id: id, data: data}, - "slot3": {id: id, data: data}, "slot4": {id: id, data: data}, "slot5": {id: id, data: data}, - "slot6": {id: id, data: data}, "slot7": {id: id, data: data}, "slot8": {id: id, data: data} - }, - liquid: "water", - liquidAmount: 0.1, - dop: { - id: ItemID.crate, - data: 0, - dec: true - }, - result: { - id: ItemID["crate" + name], - count: 1, - data: 0 - } - }); + IDRegistry.genItemID(crateId); + Item.createItem(crateId, "Crate (" + itemName + ")", {name: texture, meta: 0}, {}); - CarpenterManager.registerRecipe({ - input: {"slot4": {id: ItemID["crate" + name], data: 0}}, - result: { - id: id, - count: 9, - data: data - } - }); + CarpenterManager.registerRecipe({ + input: { + "slot0": {id: id, data: data}, "slot1": {id: id, data: data}, "slot2": {id: id, data: data}, + "slot3": {id: id, data: data}, "slot4": {id: id, data: data}, "slot5": {id: id, data: data}, + "slot6": {id: id, data: data}, "slot7": {id: id, data: data}, "slot8": {id: id, data: data} + }, + liquid: "water", + liquidAmount: 0.1, + special: { + id: ItemID.crate, + data: 0, + dec: true + }, + result: { + id: ItemID[crateId], + count: 1, + data: 0 + } + }); - Item.registerUseFunction("crate" + name, function (coords, item) { - World.drop(coords.relative.x + 0.5, coords.relative.y + 0.1, coords.relative.z + 0.5, id, 9, 0); - Player.decreaseCarriedItem(1); - }); - } + CarpenterManager.registerRecipe({ + input: {"slot4": {id: ItemID[crateId], data: 0}}, + result: { + id: id, + count: 9, + data: data + } + }); + Item.registerUseFunction(crateId, function (coords) { + World.drop(coords.relative.x + 0.5, coords.relative.y + 0.1, coords.relative.z + 0.5, id, 9, 0); + Player.decreaseCarriedItem(1); + }); +} + +if (ForestryConfig.crateEnabled) { registerCrate(3, "Dirt", "crateDirt"); registerCrate(87, "Netherrack", "crateNetherrack"); registerCrate(112, "Netherbrick", "crateNetherbricks"); @@ -77,7 +78,6 @@ if (ForestryConfig.crateEnabled === true) { registerCrate(260, "Apple", "crateApple"); registerCrate(351, "Lapis lazuli", "crateLapisLazuli", 4); registerCrate(ItemID.latex, "Latex", "crateLatex"); - registerCrate(ItemID.matter, "Matter", "crateMatter"); registerCrate(ItemID.royalJelly, "Royal jelly", "crateRoyalJelly"); registerCrate(ItemID.honeydew, "Honey dew", "crateHoneydew"); registerCrate(110, "Mycelium", "crateMycelium"); @@ -92,7 +92,6 @@ if (ForestryConfig.crateEnabled === true) { registerCrate(ItemID.beeswax, "Wax", "crateWax"); registerCrate(296, "Wheat", "crateWheat"); registerCrate(ItemID.pollen1, "Pollen", "cratePollen"); - registerCrate(ItemID.rubber, "Rubber", "crateRubber"); registerCrate(6, "Sapling", "crateSapling"); registerCrate(348, "Glowstone dust", "crateGlowstone"); registerCrate(295, "Seeds", "crateSeeds");