Date: 2023/06/08 09:19:16 UTC-07:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#+----------------------+
#- Recipe command, GUIs
#+----------------------+
#- @@@ Recipe Inventory
recipeInventory_main:
type: inventory
inventory: chest
gui: true
#title: <&color[#F4F4F4]>Recept
slots:
- [filler] [filler] [filler] [filler] [] [filler] [filler] [filler] [filler]
- [filler] [filler] [filler] [] [] [] [] [filler] [filler]
- [filler] [filler] [] [] [] [] [filler] [filler] [filler]
- [filler] [filler] [filler] [filler] [filler] [filler] [filler] [filler] [filler]
definitions:
filler: white_stained_glass_pane[display=<&7>]
#- @@@ Player Command
recipeCommand_recipe:
type: command
name: recipe
usage: /recipe [item]
description: Zobrazi recept pre vyrobenie daneho itemu.
tab completions:
1: <static[<server.material_types.filter[is_item].parse[name]>]>
data:
CRAFTING: crafting_table
COOKING: furnace
BLASTING: blast_furnace
SMOKING: smoker
CAMPFIRE: campfire
STONECUTTING: stonecutter
SMITHING: smithing_table
BREWING: brewing_stand
script:
- define material_name <context.args.first.to_lowercase.if_null[Null]>
- if <[material_name]> == Null:
- narrate "<&c>Nezadal si nazov itemu, ktoreho recept chces najst!"
- stop
- if <[material_name]> not in <static[<server.material_types.filter[is_item].parse[name]>]>:
- narrate "<&c>Nevyzera to tak, ze si zadal existujuci item!"
- stop
# Definitions
- define item <[material_name].as[item]>
- define inventory <inventory[recipeInventory_main]>
- define map_recipes <proc[recipeProcedure_maprecipes].context[<[item]>]>
- define list <list[<[item].with[hides=ALL]>]>
# Adjustments
- adjust <[inventory]> "title:<&color[#F4F4F4]>Recept <[item].material.translated_name>"
# Main loop
- foreach <script.data_key[data]> as:material key:type:
- if <[map_recipes].keys.contains[<[type]>]>:
# Recept pre dany typ craftingu existuje
- definemap mechanizmy:
display: <&e><item[<[material]>].material.translated_name.strip_color>
lore: <&7>Pocet najdenych receptov: <&e><[map_recipes].get[<[type]>].size><n><n><&a>Klikni pre zobrazenie receptov!
quantity: <[map_recipes].get[<[type]>].size>
- else:
# Recept pre dany typ craftingu neexistuje
- definemap mechanizmy:
display: <&c><item[<[material]>].material.translated_name.strip_color>
lore: <&7>Pocet najdenych receptov: <&c>0
quantity: 1
- define list:->:<item[<[material]>].with_map[<[mechanizmy]>]>
# Inventory setter
- inventory fill destination:<[inventory]> origin:<[list]>
- inventory open destination:<[inventory]> player:<player>
#- @@@ Recipe Procedure
recipeProcedure_maprecipes:
type: procedure
definitions: item
script:
- define map_recipes <map>
- foreach CRAFTING|COOKING|BLASTING|SMOKING|CAMPFIRE|STONECUTTING|SMITHING|BREWING as:type:
- foreach next if:<[item].recipe_ids[<[type]>].is_empty>
# Dany item ma pre tento typ nejake recepty
- define list_recipes <list>
- foreach <[item].recipe_ids[<[type]>]> as:recipe_id:
# Recipe id predstavuje nazov toho speci itemu
# trebars minecraft:diamond_from_deepslate_ore...
- define list_recipes:->:<server.recipe_items[<[recipe_id]>]>
# Vlozime ulozene recepty do mapy
- define map_recipes <[map_recipes].with[<[type]>].as[<[list_recipes]>]>
- determine <[map_recipes]>