{"id":17703363,"url":"https://github.com/vianpyro/minecraft_datapacks_generator","last_synced_at":"2025-03-13T06:31:59.535Z","repository":{"id":54264837,"uuid":"338450740","full_name":"Vianpyro/minecraft_datapacks_generator","owner":"Vianpyro","description":"Create Minecraft datapacks using Python!","archived":true,"fork":false,"pushed_at":"2021-02-28T13:35:01.000Z","size":47,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-06T08:32:26.060Z","etag":null,"topics":["datapacks","minecraft","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Vianpyro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-12T22:44:30.000Z","updated_at":"2023-11-08T12:39:33.000Z","dependencies_parsed_at":"2022-08-13T10:21:00.788Z","dependency_job_id":null,"html_url":"https://github.com/Vianpyro/minecraft_datapacks_generator","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vianpyro%2Fminecraft_datapacks_generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vianpyro%2Fminecraft_datapacks_generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vianpyro%2Fminecraft_datapacks_generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vianpyro%2Fminecraft_datapacks_generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vianpyro","download_url":"https://codeload.github.com/Vianpyro/minecraft_datapacks_generator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243357719,"owners_count":20277988,"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":["datapacks","minecraft","python"],"created_at":"2024-10-24T20:22:46.866Z","updated_at":"2025-03-13T06:31:59.269Z","avatar_url":"https://github.com/Vianpyro.png","language":"Python","readme":"# [Minecraft](https://www.minecraft.net/download)-[Datapacks](https://minecraft.gamepedia.com/Data_Pack)-Generator\n\n## How to use?\n* First of all make sure you have [Python](https://www.python.org/downloads/) **3.9.0** or above installed on your computer.\n* Download this repository in the folder where the datapack should be generated.\n* Create a new empty [Python](https://www.python.org/downloads/) file.\n* Import the library in your new [Python](https://www.python.org/downloads/) file like this :\n```py\nfrom minecraft_datapacks_generator import *\n```\n* Create and compile your own datapack.\n* Once the datapack is generated, paste it in the *datapacks* folder of your [Minecraft](https://www.minecraft.net/download) world.\n* Type `/reload` to load the datapack.\n* Have fun playing with your brand new handmade datapack!\n\n### Example:\n```python\nfrom minecraft_datapacks_generator import *\n\nmy_datapack_title = 'My_Datapack'\nsubfolder_title = Datapack(my_datapack_title).subfolder_title\n\nmyDatapack = Datapack(\n    title = my_datapack_title,\n    path='~\\\\home\\\\Vianpyro\\\\.minecraft\\\\saves\\\\world_42\\\\datapacks',\n    author = 'Vianpyro',\n    pack_meta = {\n        'minecraft_version': '1.16.4',\n        'description': 'Have fun using my first datapack!'\n    },\n    content = {\n        'advancements': {\n            'root': {\n                \"display\": {\n                    \"title\": {\n                        \"text\": \"God\",\n                        \"color\": \"red\",\n                        \"bold\": True,\n                    },\n                    \"description\": {\n                        \"text\": \"Vianpyro!\",\n                        \"color\": \"white\",\n                        \"italic\": True\n                    },\n                    \"icon\": {\n                        \"item\": \"minecraft:grass_block\"\n                    },\n                    \"frame\": \"goal\",\n                    \"show_toast\": True,\n                    \"announce_to_chat\": True,\n                    \"hidden\": False,\n                    \"background\": \"minecraft:textures/gui/advancements/backgrounds/dirt.png\"\n                },\n                \"criteria\": {\n                    \"c1\": {\n                        \"trigger\": \"minecraft:slept_in_bed\"\n                    }\n                }\n            }\n        },\n        'functions': {\n            'load': f'tellraw @a [\"\", {{\"text\": \"{my_datapack_title} \u003e Successfuly reloaded the datapack!\", \"color\": \"green\"}}]',\n            'raycast': Raycast(\n                datapack_name=subfolder_title,\n                function_name='raycast',\n                distance=50,\n                step=0.5,\n                goal='execute if block ~ ~ ~ stone',\n                output=\"say Stoned\",\n                display_particle='flame'\n            ),\n            'test': [\n                'say test ok',\n                'say test ko'\n            ],\n            'test2': import_from_file('resources/functions/silvathor_random')\n        },\n        'predicates': {\n            'my_predict': {\n                \"condition\": \"minecraft:entity_properties\",\n                \"entity\": \"this\",\n                \"predicate\": {\n                    \"type\": \"minecraft:player\",\n                    \"flags\": {\n                        \"is_sprinting\": True\n                    }\n                }\n            }\n        }\n    },\n    auto_replace=True\n)\n\nmyDatapack.content['functions']['main'] = [\n    'scoreboard objectives add vianpyro_RAYCAST minecraft.used:minecraft.carrot_on_a_stick',\n    f'execute as @a if score @s vianpyro_RAYCAST matches 1 at @s anchored eyes run function {subfolder_title}:raycast',\n    'scoreboard players set @a[scores={vianpyro_RAYCAST=1}] vianpyro_RAYCAST 0'\n]\n\nmyDatapack.compile()\n```\n* In this example, I start by importing the wmcpy \"library\", this line is ***required*** for the datapack to be generated!!\n* I also create a variable containing the name of my datapack because I want to be able to change it in every file I mention it.\n* Then I create another variable containing an instance of the class \"Datapack\" to start the creation of my datapack.\n* The title is the name of the datapack I'll paste in the *datapacks* folder of my [Minecraft](https://www.minecraft.net/download) world.\n* The author is me, [Vianpyro](https://github.com/Vianpyro).\n* The pack_meta is the informations I'll set in the *pack.mcmeta* file, this file is very important; it allows [Minecraft](https://www.minecraft.net/download) to read your datapack.\n* As you can see I use 2 *reserved* names: ***main*** - containing the functions I want to repeat every [Minecraft](https://www.minecraft.net/download) tick - and ***load*** - once when the datapack is reloaded.\n* Then I write whatever I want to be in my datapack ; one advancement, 4 functions and a predicate.\n* I know that the new version of my datapack is better than the older so I want to replace it without being asked when I run the program.\n* I also add another function - **main** - after the initialisation of my datapack because I want to be able to change it whenever I want without having to search for it in the big block of code above.\n* Once I'm sure I don't have anything to add to my datapack I compile it.\n* At last, when the datapack is successfuly generated I just paste it into my [Minecraft](https://www.minecraft.net/download) world to enjoy the features I added.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvianpyro%2Fminecraft_datapacks_generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvianpyro%2Fminecraft_datapacks_generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvianpyro%2Fminecraft_datapacks_generator/lists"}