{"id":22205353,"url":"https://github.com/stevertus/objd_crafting","last_synced_at":"2025-03-25T03:25:09.315Z","repository":{"id":61974060,"uuid":"190459893","full_name":"Stevertus/objd_crafting","owner":"Stevertus","description":"The objd_crafting extension for objD gives you a customizable API for a Craftingtable, that works with nbt data.","archived":false,"fork":false,"pushed_at":"2021-04-11T16:57:54.000Z","size":41,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-30T04:17:08.048Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":" https://stevertus.com/tools/objd_crafting","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Stevertus.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-05T19:59:22.000Z","updated_at":"2023-04-25T16:29:20.000Z","dependencies_parsed_at":"2022-10-24T13:30:56.745Z","dependency_job_id":null,"html_url":"https://github.com/Stevertus/objd_crafting","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stevertus%2Fobjd_crafting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stevertus%2Fobjd_crafting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stevertus%2Fobjd_crafting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stevertus%2Fobjd_crafting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Stevertus","download_url":"https://codeload.github.com/Stevertus/objd_crafting/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245390646,"owners_count":20607487,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-02T17:30:02.692Z","updated_at":"2025-03-25T03:25:09.286Z","avatar_url":"https://github.com/Stevertus.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Crafting API\nThe objd_crafting extension for objD gives you a customizable API for a Craftingtable, that works with nbt data.\nThis documentation focuses on the **CraftingTable** and **Recipe** Widgets and generating a crafting package with objD. If you want to use template packages or the online generator, take a look at this article:  [https://stevertus.com/tools/objd_crafting](https://stevertus.com/tools/objd_crafting) \n## Installation\nTo install the crafting module just include `objd_crafting` in the pubspec.yaml:\n```yaml\ndependencies:\n  ...\n  objd_crafting:\n  ...\n```\n## CraftingTable\nThe CraftingTable is the core widget to instantiate a custom crafter. It generates a pack(with a custom namespace) itself as well as the needed functions depending on the inputs.\nThe Crafter is a modified chest with an armorstand inside to implement the logic.\n\n| Constructor | (all optional) |\n|--|--|\n| name | your custom namespace for the pack and all the scores |\n|displayName| a TextComponent for the name that is displayed in the GUI|\n| id | the starting id of your recipes(automatically increases) |\n| recipes | a list of your recipes|\n| recipeSource | another file location for a recipe function|\n|recipeResultSource |another file location for the result function|\n|placeholder| an Item that blocks all the slots that are not used|\n|guiModel| an Item that is retextured to display a GUI; replaces a placeholder by specifing the Slot of the Item|\n|blockModel| replaces the head slot of the Armorstand to display a model for the block |\n|invisibleHitbox|bool whether to include code to make the chest invisible(default = true)|\n|useBarrel|set to true if you want to use a barrel instead|\n|giveCommandFunction|bool whether to include a function to generate recipes in minecraft|\n|main|a List of Widgets that are executed every tick|\n|onDestroy| a Widget that is executed when the crafting table is destroyed|\n\nAfter you specified all your wanted options and visuals, you get a fully working datapack. \nIngame run the `set` function to create a new craftingtable at the current location. Obviously you can also trigger this with other packs as well.\nIn this craftingtable you can then use your specified recipes.\n## Recipes\nThe recipes of a craftingtable are instantiated in the recipes field. A basic recipe takes in ingredient Items with the slot and a result Item.\n\n|Recipe|  |\n|--|--|\n| Map\u003cslot,Item\u003e | The ingredients as a Map with the Slot(1 to 9) on the one side and your Item on the other |\n|Item| your result Item|\n|id| overrides the automatically generated id(optional) |\n|exactlyPlaced| bool that requires to leave all unused slots empty(default = false) |\n|exactResult| a number that limits the result count(optional) |\n\n**Example:**\n```dart\nRecipe(\n          {\n            1: Item(Blocks.oak_planks),\n            2: Item(Blocks.oak_planks),\n            4: Item(Blocks.oak_planks),\n            5: Item(Blocks.oak_planks),\n          },\n          Item(Blocks.crafting_table,Count:2,nbt:{\"MyNBT\":1})\n)\n```\nYou can also set the Count variable of any of the items to generate a ratio. In this case you craft 2 craftingtables out of 4 oak_planks.\n\n### Recipe.shapeless\nThe API also supports shapeless crafting. That means you can set the ingredients in any shape and it would be the same result.\n \n|Recipe.shapeless|  |\n|--|--|\n| List\\\u003cItem\u003e | The ingredients in any shape(without slots) |\n|...| stays the same|\n\n**Example:**\n\n```dart\nRecipe.shapeless(\n    [\n       Item(Blocks.oak_planks),\n       Item(Items.diamond)\n    ],\n    Item(Items.diamond_sword)\n)\n```\n### Recipe.fromJson\nWith objD you can also import usual minecraft recipes in json data. objD automatically parses that and converts it to a command.\n\n|Recipe.fromJson|  |\n|--|--|\n| Map | The recipe in json form |\n|...| stays the same|\n\n**Example:**\n\n```dart\nRecipe.fromJson(\n  {\n\t\"type\": \"minecraft:crafting_shaped\",\n    \"pattern\": [\n      \"## \",\n      \"## \",\n      \"   \"\n    ],\n    \"key\": {\n      \"#\": {\"item\": \"minecraft:oak_planks\"}\n    },\n    \"result\": {\n\t    \"item\": \"minecraft:crafting_table\",\n\t    \"Count\": 2\n\t    \"nbt\": {\n\t\t\t\t\"MyNBT\":1\n\t\t}\n    }\n  }\n)\n```\nWhich would result into the same recipe as the beginning. Also note that the json is extended by the Count and nbt properties as well.\n\n**Example with shapeless crafting:**\n\n```dart\nRecipe.fromJson(\n{\n    \"type\": \"minecraft:crafting_shapeless\",\n    \"ingredients\": [\n        {\n            \"item\": \"minecraft:oak_planks\"\n        },\n        {\n            \"item\": \"minecraft:diamond\"\n        }\n    ],\n    \"result\": {\n        \"item\": \"minecraft:diamond_sword\"\n    }\n}\n)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevertus%2Fobjd_crafting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstevertus%2Fobjd_crafting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevertus%2Fobjd_crafting/lists"}