|
| 1 | +--- |
| 2 | +icon: crate-empty |
| 3 | +--- |
| 4 | + |
| 5 | +# New Pack |
| 6 | + |
| 7 | +You want to create a new pack! This is the easiest one! |
| 8 | + |
| 9 | +Ensure you have cloned [BEComTweaks/behaviour-packs](https://github.com/BEComTweaks/behaviour-packs), [BEComTweaks/crafting-tweaks](https://github.com/BEComTweaks/crafting-tweaks) or [BEComTweaks/resource-packs](https://github.com/BEComTweaks/resource-packs). |
| 10 | + |
| 11 | +Open the newly cloned folder using VSCode. In the directory list, open the `jsons` folder, followed by the `packs` folder. You should now see a list of `.json` files. Click the json for the category that you want to add your pack to. |
| 12 | + |
| 13 | +### JSON Format |
| 14 | + |
| 15 | +The format for a pack is as follows |
| 16 | + |
| 17 | +```json |
| 18 | +{ |
| 19 | + "pack_id": "<pack id>", |
| 20 | + "pack_name": "<pack name>", |
| 21 | + "pack_description": "<pack description>", |
| 22 | + "conflict": [ |
| 23 | + "<pack ids>" |
| 24 | + ], |
| 25 | + "message": [ |
| 26 | + "<level>", |
| 27 | + "<notes>" |
| 28 | + ], |
| 29 | + "icon": "<ext of icon>", |
| 30 | + "priority": "<int>", |
| 31 | + "regolith": "<bool>" |
| 32 | +} |
| 33 | +``` |
| 34 | + |
| 35 | +The only required definitions are `pack_id`, `pack_name` and `pack_description`. For the rest, they aren't required. Let's go through what each one defines. |
| 36 | + |
| 37 | +#### Pack ID |
| 38 | + |
| 39 | +* This defines a unique identifier for a given pack, used for loading selected packs from a URL, creation of a pack and defining conflicts. |
| 40 | +* Must be a non-empty string and is required. |
| 41 | + |
| 42 | +#### Pack Name |
| 43 | + |
| 44 | +* This defines the name of the given pack, used in the website's UI, but has no other purpose in the backend. |
| 45 | +* Must be a non-empty string and is required. |
| 46 | + |
| 47 | +#### Pack Description |
| 48 | + |
| 49 | +* This defines the description for the given pack, added as an explanation for the pack. No other purpose in the backend. |
| 50 | +* Must be a string, but can be empty and is required. |
| 51 | + |
| 52 | +#### Conflict |
| 53 | + |
| 54 | +* This defines the list of packs that conflict with the current pack. This is used to warn the user of enabling such a pack with another pack. This has no purpose in the backend. |
| 55 | +* Must be an array containing non-empty strings, but can be omitted. |
| 56 | + |
| 57 | +#### Message |
| 58 | + |
| 59 | +* An extra stylised description is used to provide additional information to the user. This has no purpose in the backend. |
| 60 | +* Must be in the format below, but can be omitted |
| 61 | + |
| 62 | +```json |
| 63 | +"message": [ |
| 64 | + "error/info/warn", |
| 65 | + "<information>" |
| 66 | +] |
| 67 | +``` |
| 68 | + |
| 69 | +* A message of level `error` has the information show up as <mark style="color:red;">red</mark> |
| 70 | +* A message level of `info` has the information show up as <mark style="color:blue;">cyan</mark> |
| 71 | +* A message level of `warn` has the information show up as <mark style="color:orange;">orange</mark> |
| 72 | + |
| 73 | +#### Icon |
| 74 | + |
| 75 | +* A setting to change the extension of the pack icon used. This means that pack icons added as a `WebP` or even `QOI` can be used. Added for `gif`, but preferred as `png`. This has no purpose in the backend. |
| 76 | +* Must be a string that doesn't contain the period `.`, but can be omitted |
| 77 | + |
| 78 | +#### Priority |
| 79 | + |
| 80 | +* This defines the priority level of a pack, which refers to whether conflicting packs can overwrite the other in the occasion that a compatibility isn't available for it. This has no purpose in the frontend. |
| 81 | +* Must be an integer lower than 999. |
| 82 | + |
| 83 | +#### Regolith |
| 84 | + |
| 85 | +* This defines whether the pack added is a pack that is required to be built using [Regolith](https://regolith-docs.readthedocs.io/). This has no purpose in the frontend. |
| 86 | +* Must be a boolean. |
| 87 | + |
| 88 | +With your selected options, insert the dictionary between one of the items inside the array. |
| 89 | + |
| 90 | +### Folder |
| 91 | + |
| 92 | +Now, back at the root directory where your repository is at, open the `packs` folder, followed by the category. If the category's json contains a key `"location"`, open the appropriate directory. Else, just open the category's directory. Inside there, create a new folder and name it `<pack id>` from your dictionary. |
| 93 | + |
| 94 | +Inside it, copy and paste a template icon from `/pack_icons/` into the pack's folder and name it as `pack_icon.png` . Using an image editing software like MS Paint, Aseprite, Pixelorama, etc, make your pack icon. |
| 95 | + |
| 96 | +After you have created the pack icon,  |
| 97 | + |
| 98 | +* If you are using regolith, continue with initialising a regolith project. |
| 99 | +* Else, create a new folder called `files` inside the pack and dump the pack (aside from `manifest.json` and `pack_icon.png`) inside the `files` folder. |
| 100 | + |
| 101 | +### Checks |
| 102 | + |
| 103 | +Now, using your terminal, head to the folder with the repository. Ensure that you have an active Python Virtual Environment (refer to [#setting-up-the-modules](../getting-started.md#setting-up-the-modules "mention") if you have not set it up). Run |
| 104 | + |
| 105 | +```sh |
| 106 | +python pys/pre_commit.py --format |
| 107 | +``` |
| 108 | + |
| 109 | +You can choose to add in a `--no-stash` if you are sure you won't accidentally nuke your workspace. |
| 110 | + |
| 111 | +After the script finishes running, you can run |
| 112 | + |
| 113 | +```sh |
| 114 | +git status |
| 115 | +``` |
| 116 | + |
| 117 | +to see your changed files. If they are all right, you can run |
| 118 | + |
| 119 | +```sh |
| 120 | +git add . |
| 121 | +``` |
| 122 | + |
| 123 | +to stage your added files, then |
| 124 | + |
| 125 | +```sh |
| 126 | +git commit -m "<message>" |
| 127 | +``` |
| 128 | + |
| 129 | +where `<message>` is a summary of the changes you made. Finally, run |
| 130 | + |
| 131 | +```sh |
| 132 | +git push |
| 133 | +``` |
| 134 | + |
| 135 | +to push the changes to the remote repository. Now check your repository in the web (the url from [#forking-the-repo](../getting-started.md#forking-the-repo "mention")). You should see your new commit message. You might also see a banner saying that you can create a new Pull Request. Click on it and you should see something like this |
| 136 | + |
| 137 | +<figure><img src="../.gitbook/assets/image.png" alt=""><figcaption><p>Pull Request</p></figcaption></figure> |
| 138 | + |
| 139 | +Add a title for your change, like `Added <pack> inside <category>` and a description (can be empty ~~like your heart~~) |
| 140 | + |
| 141 | +Press `Create pull request` and you are done! |
0 commit comments