From 91d8a710a5f0a5214784efd17e43baea79cb2194 Mon Sep 17 00:00:00 2001 From: C4 <29991504+TheIllusiveC4@users.noreply.github.com> Date: Wed, 3 Jan 2024 20:32:53 -0800 Subject: [PATCH] Add Diet example datapack --- docs/assets/diet_example.zip | Bin 0 -> 1855 bytes docs/diet/datapack-example.md | 135 +++++++++++++++++++++++++++++++ docs/diet/food-classification.md | 4 +- docusaurus.config.js | 2 +- 4 files changed, 138 insertions(+), 3 deletions(-) create mode 100644 docs/assets/diet_example.zip create mode 100644 docs/diet/datapack-example.md diff --git a/docs/assets/diet_example.zip b/docs/assets/diet_example.zip new file mode 100644 index 0000000000000000000000000000000000000000..daa81f535d722f1ee152f26a1c470af4cc7d9043 GIT binary patch literal 1855 zcmWIWW@Zs#00G@{d`{+A(|#R+?v2%L=K^+K)nepoOjBA zdNu;FEp9D$UF($;<;MlG^^WT+IdoE$>_RH9yfwdb#w6mTQWyd00oMO15ps z`+I*bWZk+HoR+@dVDssZ6H?DS&}dX%ZNzvfN$$+K7nxhm?f!L9vSr$=2S)F&2s$fH zxZD^0=yBMz2DRHYf}Elrtj+%E&g&;g3xr6%30TPZYHLy@Q-77);}@Twt<#U(A9!r* zuCM=o-+%J<)Zg0DSr!Z*cfV&3s+-anW?%Dl(~c$GVoT@UeH1cff0dhH+Vbn_umIy= zcwMR-VJG+Ld?3)Xxj@Vf#081T*?PIjxv3?I(4^mVr9yxH790DWWc1E z^Vz2a7M%(9SnF{{_k?Gtho_DwOJ;z_Y5kyrlRmnEmmDv#PwHep^+atN!&k|fj!UvC zcV;mLcr!AIFyJm1fYt+n0E9v*B@p_sl@kyRAblD@j3`~8r3OMXwsHfZITTYftQ3J6 zfxR378NtY)037=f9^!GNtG0ht8}qE!UV!V^~5vN*z-*-Y5N3hY;ShDSIP qTb4&Sb2&k?kP84rd}7a42y^E!qvWvwZ&o&tBsUNW1Es`RKs*4JJpI`K literal 0 HcmV?d00001 diff --git a/docs/diet/datapack-example.md b/docs/diet/datapack-example.md new file mode 100644 index 0000000..0e8e467 --- /dev/null +++ b/docs/diet/datapack-example.md @@ -0,0 +1,135 @@ +--- +sidebar_position: 10 +--- + +# Example Datapack + +An example datapack for configuring various diet mechanics, including adding a new food group and adding food to that +new food group. + +## Getting Started + +First, download the [example datapack](../assets/diet_example.zip). + +Unzip the file and there will be the following folder structure: + +``` +|data +--|diet + --|tags + --|items + --|test_group.json +--|diet_example + --|diet + --|groups + --|test_group.json + --|suites + --|builtin.json +|pack.mcmeta +``` + +The `.mcmeta` file and `.json` files can be opened and edited in any text editor, such as Notepad. + +:::note + +**Why are there two folders for *diet* and *diet_example*?** + +The namespace used for this datapack is `diet_example`. The `diet_example` folder has a sub-folder called `diet` which +houses the `groups` and `suites` folder. This is the custom data that is specifically for the Diet mod. On the other +hand, the `diet` folder that houses the `tags` folder is using the name as a separate namespace for the purposes of +adding item tags, which are read by vanilla. + +::: + +## New Food Group + +Adding a new food group is controlled by the `data/diet_example/diet/groups/test_group.json` file: + +```json +{ + "icon": "minecraft:diamond", + "color": "#ffffff", + "order": 5, + "default_value": 0.25, + "gain_multiplier": 2.0, + "decay_multiplier": 0.5, + "beneficial": true +} +``` +The file and file name specifies these properties for the food group: +* The identifier for the food group is `test_group`, as denoted by the file name +* The icon is the one for the `minecraft:diamond` item +* The color associated with the food group is `#ffffff`, or white +* The order is `5`, denoting where it is placed on the Diet GUI +* The default value is `0.25`, or 25% +* The gain multiplier is `2.0`, doubling the percentages on all gains for the food group +* The decay multiplier is `0.5`, halving the rate of decay for the food group +* The food group is `beneficial`, which will render as green in tooltips + +For more information on the fields and customization of food groups, please refer to [the food groups page](diet-groups.md). + +## Adding the New Food Group to a Suite + +Just creating the food group isn't enough, as now it has to be added to a diet suite in order to appear anywhere. The +most relevant diet suite will be the default one, named `builtin`, which is configured by the `data/diet_example/diet/suites/builtin.json` file: + +```json +{ + "replace": false, + "groups": [ + "test_group" + ], + "effects": [ + { + "status_effects": [ + { + "name": "minecraft:regeneration", + "power": 3 + } + ], + "conditions": [ + { + "groups": ["test_group"], + "match": "all", + "above": 0.8, + "below": 1.0 + } + ] + } + ] +} +``` +The file and file name specifies these properties for the diet suite: +* The identifier for the diet suite is `builtin`, as denoted by the file name. This is the same identifier as the default +one, so this file's purpose is to edit or override any previously stated values. +* These values are adding, not replacing, its contents since `replace` is `false`. +* The groups to add are just `test_group` +* The effect added is a `minecraft:regeneration` status effect when `test_group` is above `0.8`, or 80% + +For more information on the fields and customization of diet suites, please refer to [the diet suites page](diet-suites.md). + +## Adding an Item to a Food Group + +Items are added to food groups by adding them to the relevant item tag. In the example datapack, the food group is `test_group` +so an item tag for `diet:test_group` is created at `data/diet/tags/items/test_group.json`: + +```json +{ + "replace": false, + "values": [ + "minecraft:apple" + ] +} +``` + +The file name is the same as the identifier for the food group and will be the name of the tag that is created. By +setting `replace` to `false`, the values are added to the tag instead of replacing them. Listing `minecraft:apple` in +the `values` array will add the apple item to the tag and consequently to the `test_group` food group. + +For more information on tags and item tags, please refer to the [page on the Minecraft wiki](https://minecraft.wiki/w/Tag). + +## Activating the Datapack + +Datapacks are created on a per-world basis and need to be placed in the `datapacks` folder of the `world` folder on a +dedicated server or the `saves/(World Name)` folder in single player. They should automatically be enabled upon loading +the datapack for the first time in the world. diff --git a/docs/diet/food-classification.md b/docs/diet/food-classification.md index 6ab5c86..e06801e 100644 --- a/docs/diet/food-classification.md +++ b/docs/diet/food-classification.md @@ -52,14 +52,14 @@ In this file, type this: "values": [] } ``` -This is the basic structure for a tag file. `replace` dictates whether or not you're just adding tags or completely overriding tags. I recommend leaving this at `false` unless you know what you're doing. `values` is the property you're most interested in. This is where you list alllll of the items that you want to add to the group. For example, if you'd like to add an item called `"examplemod:bacon"`: +This is the basic structure for a tag file. `replace` dictates whether you're just adding tags or completely overriding tags. I recommend leaving this at `false` unless you know what you're doing. `values` is the property you're most interested in. This is where you list alllll of the items that you want to add to the group. For example, if you'd like to add an item called `"examplemod:bacon"`: ``` { "replace": "false", "values": ["examplemod:bacon"] } ``` -You can put as many values as you want here but they must all be comma separated inside of the brackets. Like so: +You can put as many values as you want here, but they must all be comma separated inside the brackets. Like so: ``` { "replace": "false", diff --git a/docusaurus.config.js b/docusaurus.config.js index e97da4e..9b8a060 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -90,7 +90,7 @@ const config = { copyright: `Copyright © ${new Date().getFullYear()} Illusive Soulworks, Built with Docusaurus.`, }, prism: { - additionalLanguages: ['java', 'gradle'], + additionalLanguages: ['java', 'gradle', 'json', 'toml'], theme: prismThemes.github, darkTheme: prismThemes.dracula, },