Skip to content

Commit 561bcdc

Browse files
committed
update: fix some recipes and refactor some code
1 parent 2a7d251 commit 561bcdc

71 files changed

Lines changed: 1007 additions & 69 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

data/source/overgeared.pkl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ local recipesToDisable = new {
1616
"steel_chestplate"
1717
"steel_leggings"
1818
"steel_boots"
19+
20+
"copper_plate"
21+
"iron_plate"
22+
"steel_plate"
1923
}
2024

2125
recipes {

data/source/toolworking.pkl

Lines changed: 28 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,29 @@
11
amends "./@base.pkl"
22

3+
import "../utils.pkl" as utils
4+
35
local tools = List("axe", "hoe", "shovel", "pickaxe", "sword", "hammer", "paxel")
4-
local materials = List("iron", "gold", "copper", "bronze", "brass", "steel")
56

67
local basicRecipes = new {
7-
["forging/golden_sheet"] {
8-
type = "overgeared:forging"
9-
category = "misc"
10-
hammering = 3
11-
has_polishing = true
12-
has_quality = false
13-
14-
key {
15-
["#"] {
16-
item = "minecraft:gold_ingot"
8+
for (name, material in utils.Materials) {
9+
["forging/\(name)_sheet"] {
10+
type = "overgeared:forging"
11+
category = "misc"
12+
hammering = 3
13+
has_polishing = false
14+
has_quality = false
15+
need_quenching = true
16+
needs_minigame = true
17+
show_notification = true
18+
tier = "stone"
19+
20+
key {
21+
I { item = if (material.needsHeat()) material.heated() else material.ingot }
1722
}
18-
}
1923

20-
need_quenching = true
21-
needs_minigame = true
22-
23-
pattern {
24-
"#"
25-
}
26-
27-
result {
28-
item = "create:golden_sheet"
24+
pattern { " " " I " " " }
25+
result { item = material.sheet }
2926
}
30-
31-
show_notification = true
32-
tier = "stone"
3327
}
3428

3529
["forging/charcoal_dust"] = new {
@@ -316,46 +310,46 @@ recipes {
316310
}
317311
}
318312

319-
for (material in materials) {
320-
["casting_in_table/\(material)/ingot"] {
313+
for (name, material in utils.Materials) {
314+
["casting_in_table/\(name)/ingot"] {
321315
type = "createmetallurgy:casting_in_table"
322316

323317
ingredients {
324318
new { item = "toolworking:clay_ingot_mold" }
325319
new {
326320
amount = 90
327-
fluid = "createmetallurgy:molten_\(material)"
321+
fluid = material.molten()
328322
nbt {}
329323
}
330324
}
331325

332326
processingTime = 60
333327

334328
result {
335-
item = "\(sourceOf(material)):\(material)_ingot"
329+
item = if (material.needsHeat() || name == "copper") material.heated() else material.ingot
336330
}
337331
}
338332

339333
for (tool in tools) {
340-
["casting_in_table/\(material)/\(tool)"] {
334+
["casting_in_table/\(name)/\(tool)"] {
341335
type = "createmetallurgy:casting_in_table"
342336

343337
ingredients {
344338
new { item = "toolworking:clay_\(tool)_mold" }
345339
new {
346340
amount = 90
347-
fluid = "createmetallurgy:molten_\(material)"
341+
fluid = material.molten()
348342
nbt {}
349343
}
350344
}
351345

352346
processingTime = 60
353347

354348
result {
355-
when (material == "gold") {
349+
when (name == "gold") {
356350
item = "toolworking:golden_\(tool)_part"
357351
} else {
358-
item = "toolworking:\(material)_\(tool)_part"
352+
item = "toolworking:\(name)_\(tool)_part"
359353
}
360354
}
361355
}
@@ -368,7 +362,7 @@ tags {
368362
["items/\(tool)_part"] {
369363
replace = false
370364
values {
371-
for (material in materials) {
365+
for (material in utils.Materials.keys.filter((s) -> s != "tin")) {
372366
when (material == "gold") {
373367
"toolworking:golden_\(tool)_part"
374368
} else {
@@ -417,12 +411,4 @@ local function woodenPart(layout: List<String>, output: String) = new {
417411
result {
418412
item = "toolworking:\(output)"
419413
}
420-
}
421-
422-
local function sourceOf(material: String) =
423-
if (material == "brass")
424-
"create"
425-
else if (material == "steel" || material == "bronze")
426-
"create_ironworks"
427-
else
428-
"minecraft"
414+
}

data/utils.pkl

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
class Material {
2+
name : String
3+
ingot : String
4+
sheet : String
5+
6+
function source() = ingot.split(":").first
7+
function raw() = "\(source()):raw_\(name)"
8+
function molten() = "createmetallurgy:molten_\(name)"
9+
function heated() = "overgeared:heated_\(name)_ingot"
10+
function needsHeat() = List("iron", "steel").contains(name)
11+
}
12+
13+
const Materials = new Mapping<String, Material> {
14+
["copper"] = new Material {
15+
name = "copper"
16+
ingot = "minecraft:copper_ingot"
17+
sheet = "create:copper_sheet"
18+
}
19+
20+
["iron"] = new Material {
21+
name = "iron"
22+
ingot = "minecraft:iron_ingot"
23+
sheet = "create:iron_sheet"
24+
}
25+
26+
["gold"] = new Material {
27+
name = "gold"
28+
ingot = "minecraft:gold_ingot"
29+
sheet = "create:gold_sheet"
30+
}
31+
32+
["brass"] = new Material {
33+
name = "brass"
34+
ingot = "create:brass_ingot"
35+
sheet = "create:brass_sheet"
36+
}
37+
38+
["tin"] = new Material {
39+
name = "tin"
40+
ingot = "create_ironworks:tin_ingot"
41+
sheet = "create_ironworks:tin_sheet"
42+
}
43+
44+
["bronze"] = new Material {
45+
name = "bronze"
46+
ingot = "create_ironworks:bronze_ingot"
47+
sheet = "create_ironworks:bronze_sheet"
48+
}
49+
50+
["steel"] = new Material {
51+
name = "steel"
52+
ingot = "create_ironworks:steel_ingot"
53+
sheet = "create_ironworks:steel_sheet"
54+
}
55+
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ mapping_version=1.20.1
1414
mod_id=toolworking
1515
mod_name=Create Toolworking
1616
mod_license=Apache 2.0
17-
mod_version=0.1.4-ALPHA
17+
mod_version=0.1.5-ALPHA
1818
mod_group_id=dev.jodevnull
1919
mod_authors=jo-devnull
2020
mod_description=Toolmaking is harder and more realistic
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"type": "overgeared:forging",
3+
"category": "armors",
4+
"hammering": 3,
5+
"has_polishing": false,
6+
"has_quality": true,
7+
"key": {
8+
"-": {
9+
"item": "create:brass_sheet"
10+
}
11+
},
12+
"minimum_quality": "poor",
13+
"need_quenching": false,
14+
"needs_minigame": false,
15+
"requires_blueprint": false,
16+
"pattern": [
17+
"- -",
18+
"- -"
19+
],
20+
"result": {
21+
"item": "create_ironworks:brass_armor_boots"
22+
},
23+
"show_notification": true,
24+
"tier": "stone"
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"type": "overgeared:forging",
3+
"category": "armors",
4+
"hammering": 3,
5+
"has_polishing": false,
6+
"has_quality": true,
7+
"key": {
8+
"-": {
9+
"item": "create_ironworks:bronze_sheet"
10+
}
11+
},
12+
"minimum_quality": "poor",
13+
"need_quenching": false,
14+
"needs_minigame": false,
15+
"requires_blueprint": false,
16+
"pattern": [
17+
"- -",
18+
"- -"
19+
],
20+
"result": {
21+
"item": "create_ironworks:bronze_armor_boots"
22+
},
23+
"show_notification": true,
24+
"tier": "stone"
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"type": "overgeared:forging",
3+
"category": "armors",
4+
"hammering": 3,
5+
"has_polishing": false,
6+
"has_quality": true,
7+
"key": {
8+
"-": {
9+
"item": "create:copper_sheet"
10+
}
11+
},
12+
"minimum_quality": "poor",
13+
"need_quenching": false,
14+
"needs_minigame": false,
15+
"requires_blueprint": false,
16+
"pattern": [
17+
"- -",
18+
"- -"
19+
],
20+
"result": {
21+
"item": "create_ironworks:copper_armor_boots"
22+
},
23+
"show_notification": true,
24+
"tier": "stone"
25+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"type": "overgeared:forging",
3+
"category": "armors",
4+
"hammering": 3,
5+
"has_polishing": false,
6+
"has_quality": true,
7+
"key": {
8+
"-": {
9+
"item": "create_ironworks:steel_sheet"
10+
}
11+
},
12+
"minimum_quality": "poor",
13+
"need_quenching": false,
14+
"needs_minigame": false,
15+
"requires_blueprint": false,
16+
"pattern": [
17+
"- -",
18+
"- -"
19+
],
20+
"result": {
21+
"item": "create_ironworks:steel_armor_boots"
22+
},
23+
"show_notification": true
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"type": "overgeared:forging",
3+
"category": "armors",
4+
"hammering": 5,
5+
"has_polishing": false,
6+
"has_quality": true,
7+
"key": {
8+
"-": {
9+
"item": "create:sturdy_sheet"
10+
}
11+
},
12+
"minimum_quality": "poor",
13+
"need_quenching": false,
14+
"needs_minigame": false,
15+
"requires_blueprint": false,
16+
"pattern": [
17+
"- -",
18+
"- -"
19+
],
20+
"result": {
21+
"item": "create_ironworks:sturdy_armor_boots"
22+
},
23+
"show_notification": true
24+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"type": "overgeared:forging",
3+
"category": "armors",
4+
"hammering": 5,
5+
"has_polishing": false,
6+
"has_quality": true,
7+
"key": {
8+
"-": {
9+
"item": "create:brass_sheet"
10+
}
11+
},
12+
"minimum_quality": "poor",
13+
"need_quenching": false,
14+
"needs_minigame": false,
15+
"requires_blueprint": false,
16+
"pattern": [
17+
"- -",
18+
"---",
19+
"---"
20+
],
21+
"result": {
22+
"item": "create_ironworks:brass_armor_chestplate"
23+
},
24+
"show_notification": true,
25+
"tier": "stone"
26+
}

0 commit comments

Comments
 (0)