diff --git a/README.md b/README.md index 978b018..3dbf39c 100644 --- a/README.md +++ b/README.md @@ -3,24 +3,16 @@ **Easy painter** is a server-side mod for improving paintings! ## Features -* The easy painting selection GUI opens when you place/shift click a painting, showing you all the paintings that could go in that position. -* Add custom paintings to your server, no resource packs required. Just place the image and a small JSON file in the config directory ([see here](#Custom Paintings)) +* Easy painting selection GUI opens when you place/shift click a painting, showing you all the paintings that could go in that position. +* Add custom paintings to your server, no resource packs required. Just place create a simple datapack, [see here](/example). +* Painting locking, add the `locked:true` tag to a painting entity to lock it. This will make it unbreakable, unchangeable, ect. +* Painting block/entity tags, customise the blocks which can support paintings/sit informant of paintings without breaking them. + * `easy_painter/tags/blocks/cannot_support_paiting.json` - Blocks which cannot be behind paintings without them breaking + * `easy_painter/tags/blocks/paiting_ignored.json` - Blocks which can sit in-front of paintings without them breaking + * `easy_painter/tags/entity_types/painting_interact.json` - Entities which cannot share a space with paintings -## Custom Paintings -Custom paintings require 2 files to be placed in the `config/easy_painter` dirrecory (see the [example here](/example/config)). -1. The JSON file. This simply tells the mod how big the painting should be. For Example: -```json5 -{ - "blockWidth": 2, - "blockHeight": 2, - "image": "tater" //<- (optional, will assume the same as the file name if not supplied) -} -``` -2. The image file. This is the `png` image that the painting should display, it can be either named the same as the JSON file or defined in the `image` field. -The dimensions of the image need to be in the same ratio as `blockWidth` to `blockHeight` (Note: this is not a technical limitation but rather imposed as stretching images to fit dimensions looks terrible). - -### Removing Custom Paintings -To properly remove a custom painting follow the steps bellow: -1. From the console or as an op run `/easy_painter clear ` -2. Run the command again to confirm. -3. Once the server has stopped, delete the relevant files from `config/easy_painter` \ No newline at end of file +## Libraries Used +* [Image2Map](https://github.com/TheEssem/Image2Map) - TheEssem +* [sgui](https://github.com/Patbox/sgui) - Patbox +* [Server Translations](https://github.com/arthurbambou/Server-Translations) - Arthurbambou +* [FabricAPI](https://github.com/FabricMC/fabric) - FabricMC diff --git a/example/config/easy_painter/big_tater.json b/example/config/easy_painter/big_tater.json deleted file mode 100644 index fa098a1..0000000 --- a/example/config/easy_painter/big_tater.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "blockWidth": 2, - "blockHeight": 2, - "image": "tater" -} \ No newline at end of file diff --git a/example/config/easy_painter/landscape.json b/example/config/easy_painter/landscape.json deleted file mode 100644 index 9753f77..0000000 --- a/example/config/easy_painter/landscape.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "blockWidth": 2, - "blockHeight": 1 -} \ No newline at end of file diff --git a/example/config/easy_painter/landscape.png b/example/config/easy_painter/landscape.png deleted file mode 100644 index 2fec56f..0000000 Binary files a/example/config/easy_painter/landscape.png and /dev/null differ diff --git a/example/config/easy_painter/mega_tater.json b/example/config/easy_painter/mega_tater.json deleted file mode 100644 index eca9293..0000000 --- a/example/config/easy_painter/mega_tater.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "blockWidth": 4, - "blockHeight": 4, - "image": "tater" -} \ No newline at end of file diff --git a/example/datapacks/my_data_pack/data/my_mod_id/lang/en_us.json b/example/datapacks/my_data_pack/data/my_mod_id/lang/en_us.json new file mode 100644 index 0000000..5ceef7c --- /dev/null +++ b/example/datapacks/my_data_pack/data/my_mod_id/lang/en_us.json @@ -0,0 +1,5 @@ +{ + "painting.my_mod_id.tater": "The Tater", + "painting.my_mod_id.big_tater": "The BIG Tater", + "painting.my_mod_id.esher": "Waterfall" +} \ No newline at end of file diff --git a/example/datapacks/my_data_pack/data/my_mod_id/painting/big_tater.json b/example/datapacks/my_data_pack/data/my_mod_id/painting/big_tater.json new file mode 100644 index 0000000..270cfee --- /dev/null +++ b/example/datapacks/my_data_pack/data/my_mod_id/painting/big_tater.json @@ -0,0 +1,6 @@ +{ + "blockWidth": 2, + "blockHeight": 2, + "image": "tater_image", + "ditherMode": "FLOYD" +} \ No newline at end of file diff --git a/example/config/easy_painter/esher.json b/example/datapacks/my_data_pack/data/my_mod_id/painting/esher.json similarity index 100% rename from example/config/easy_painter/esher.json rename to example/datapacks/my_data_pack/data/my_mod_id/painting/esher.json diff --git a/example/config/easy_painter/esher.png b/example/datapacks/my_data_pack/data/my_mod_id/painting/esher_image.png similarity index 100% rename from example/config/easy_painter/esher.png rename to example/datapacks/my_data_pack/data/my_mod_id/painting/esher_image.png diff --git a/example/config/easy_painter/tater.json b/example/datapacks/my_data_pack/data/my_mod_id/painting/tater.json similarity index 100% rename from example/config/easy_painter/tater.json rename to example/datapacks/my_data_pack/data/my_mod_id/painting/tater.json diff --git a/example/config/easy_painter/tater.png b/example/datapacks/my_data_pack/data/my_mod_id/painting/tater_image.png similarity index 100% rename from example/config/easy_painter/tater.png rename to example/datapacks/my_data_pack/data/my_mod_id/painting/tater_image.png diff --git a/example/datapacks/my_data_pack/pack.mcmeta b/example/datapacks/my_data_pack/pack.mcmeta new file mode 100644 index 0000000..77e9d10 --- /dev/null +++ b/example/datapacks/my_data_pack/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack":{ + "pack_format":3, + "description":"A example datapack for adding paintings with Easy Painter!" + } +} \ No newline at end of file diff --git a/example/readme.md b/example/readme.md new file mode 100644 index 0000000..7d285b0 --- /dev/null +++ b/example/readme.md @@ -0,0 +1,69 @@ +# Adding Custom Painting Motives +You can add your own custom painting motives by simply adding a data pack. Follow along with the example data pack here! + +1. In your datapack add a `painting` directory. For example: +``` +my_data_pack +├───pack.mcmeta +└───data + └───my_mod_id <─ Your mod/datapack id (any valid Identifier) + ├───painting <─ The painting directory + └───lang +``` +2. Inside the `painting` place your `.png` image and a new `.json` file. The name of your json file will be the motive's identifier. +By default, the image name should be the same as the `.json` but with `_image` on the end. +``` +my_data_pack +├───pack.mcmeta +└───data + └───my_mod_id + ├───painting + │ ├───my_painting.json + │ └───my_painting_image.png + └───lang +``` +3. Edit the contents of the `.json` file to match the following template: +```json5 +{ + "blockWidth": 2, // <─ This is the paintings width in blocks + "blockHeight": 2, // <─ This is the paintings height in blocks + "image": "my_painting_image", // <─ OPTIONAL: By default the mod will look for an image of the same name with `_image`. + "ditherMode": "FLOYD" // <─ OPTIONAL: By default this will be NONE +} +``` +The image dimensions need to have the same aspect ratio as `blockWidth` and `blockHeight` (`imageWidth/imageHeight == blockWidth/blockHeight`), this is to prevent strange resizing issues. + +3.5. You can also add a translation key for your paining inside the `lang` directory, if not supplied it will use the motive's identifier. +``` +my_data_pack +├───pack.mcmeta +└───data + └───my_mod_id + ├───painting + │ ├───my_painting.json + │ └───my_painting_image.png + └───lang + └───en_us.json +``` +The translation key uses the format `painting..`, for example the contents of `en_us.json` would be: +```json +{ + "painting.my_mod_id.my_painting": "My Custom Painting" +} +``` + +4. Add the datapack to your world/mod and restart the server/use `/reload` (can cause some small issues). + +# Clearing the Cache +When the server detects a new motive, the maps are created and cached. This means the maps do not need to be re-generated each time, saving space and time. +This also means if you change an image you will need to clear this cache for the change to take effect. + +## The Automatic Easy Way +This will clear all the entire motive cache and required a server restart. +1. From the console/an operator run `/easy_painter clearcache` then again to confirm. This will save the server and then shutdown, clearing the cache in the process. +2. Restart the server, you should see in the logs that the mod regenerates the motives. + +## The Manual Technical Way +The cache is stored in the overworld's `data/custom_motives.dat` file. You can open this file with an nbt editor and manually remove a cached motive. +You can also safely delete the `map_` values contained in the motives `mapIds` lists. +**Do not touch the `currentMapId` value! It will overwrite other motives maps!** \ No newline at end of file