-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
has_alpha
to Color Parameter in head generator
* Add this to `colored_glasses` and `sunglasses3`
- Loading branch information
Showing
20 changed files
with
468 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,388 @@ | ||
## How to create a resource pack for Head Generator | ||
|
||
To add custom heads to Head Generator using a resource pack, there are two different ways to generate skins: using "textures" and "models". | ||
|
||
## Changes in 0.2.14 | ||
|
||
* Add `has_alpha` to [Color parameter](#colorobject), which allows to change the alpha of the color from the GUI, optional, default false | ||
|
||
--- | ||
|
||
### Textures | ||
|
||
**Head textures** involves adding a texture on top of the skin, so it has a __simple but limited__ functionality; a more comprehensive version would be [Head models](#models) | ||
|
||
1. Create a normal resource pack and place the head textures in the `assets/fzmm/textures/heads` folder. The textures should be 64x16 images or larger in the PNG format, with only the first 64x16 pixels being used. | ||
|
||
2. Use the resource pack like any other. When you go to the head generator screen, the heads will be added to the list and arranged alphabetically. | ||
|
||
3. To find the heads more easily, you can add them to your favorites. | ||
|
||
#### Skins | ||
You can use 64x64 textures. If you select the texture in the head generator, you can save the skin using the `Save skin` button, which will be stored in `.minecraft/fzmm/skins/`, and can be used for simple skin edits. | ||
|
||
#### Example | ||
|
||
You can check out the resource pack [FZMM Head generator example.zip](https://github.com/Zailer43/FZMM-Mod/files/10303878/FZMM.Head.generator.example.zip) to see how it's done. | ||
|
||
This example resource pack adds the following textures: | ||
- Blue mask | ||
- Ocelot mask | ||
|
||
--- | ||
|
||
### Models | ||
|
||
**Head models** is the enhanced version of [Head textures](#textures), which **allows for greater control** when manipulating the head, but it can also be a bit more cumbersome to use. | ||
|
||
Prerequisites include: | ||
|
||
- Knowledge of JSON | ||
- Having a basic image editor (to take reference pixel positions, which will be necessary for editing) | ||
|
||
To add custom heads to Head Generator using models, follow these steps: | ||
|
||
1. Create a JSON file in the following folder: `assets/fzmm/fzmm_models/heads`. The JSON files support the following structure: | ||
|
||
```json5 | ||
{ | ||
// If enabled, it will be added to the "Paintable" category | ||
// optional, default false | ||
"paintable": boolean, | ||
|
||
// If enabled, it will be added to the "Body" category and the preview of the entire skin will be displayed | ||
// optional, default false | ||
"is_editing_skin_body": boolean, | ||
|
||
// If it is to be displayed as the first result in the list of heads | ||
// optional, default false | ||
"first_result": boolean, | ||
|
||
// If enabled, then the offsets will be internally switched from right to left, for example: LEFT_LEG -> RIGHT_LEG | ||
// optional, default false | ||
"inverted_left_and_right": boolean, | ||
|
||
// optional | ||
// default: `base_skin`, `destination_skin` | ||
"textures": TextureObject[], | ||
|
||
// optional | ||
"colors": ColorObject[], | ||
|
||
// optional | ||
"offsets" OffsetObject[], | ||
|
||
"steps": StepObject[] | ||
} | ||
``` | ||
2. Use the resource pack like any other. When you go to the head generator screen, the heads will be added to the list and arranged alphabetically. | ||
|
||
3. To find the heads more easily, you can add them to your favorites. | ||
|
||
|
||
#### Structure of objects and their possible values | ||
|
||
|
||
#### Base objects | ||
|
||
<details> | ||
<summary>Objects JSON structure</summary> | ||
|
||
##### TextureObject | ||
|
||
```json5 | ||
{ | ||
"path": String, // The path of the texture in the resource pack, for example: "fzmm:textures/model_textures/texture.png" | ||
|
||
"id": String, // The id used to identify the texture for use | ||
|
||
"requested": boolean, // Whether a image field will be displayed to the user to change the value, optional, by default true | ||
} | ||
``` | ||
|
||
##### ColorObject | ||
|
||
```json5 | ||
{ | ||
"color_hex": String, // default color, format is #AARRGGBB or #RRGGBB | ||
// Example: #FFFFFF or #80FF00FF | ||
|
||
"has_alpha": Boolean, // Allows to modify color alpha from the GUI, optional, default false | ||
|
||
"id": String, // The id used to identify the color for use, | ||
|
||
"requested": boolean, // Whether a color field will be displayed to the user to change the value, optional, default true | ||
} | ||
``` | ||
|
||
##### OffsetObject | ||
|
||
```json5 | ||
{ | ||
"id": String, // To identify the offset when you want to activate or deactivate it | ||
|
||
"requested": boolean, // Whether a slider will be displayed to the user to change the value, optional, by default true | ||
|
||
"value": byte, // To determine the pixels to be offset, optional, by default 0 | ||
|
||
"min_value": byte, // Is the minimum value of `value` in the slider, optional, by default 0, | ||
|
||
"max_value": byte, // Is the maximum value of `value` in the slider, optional, by default 8 | ||
|
||
"axis": String, // Determines whether it is the X or Y axis, `X` for x and `Y` for `Y` | ||
|
||
"enabled": boolean // If enabled by default, optional, default false, when enabled the pixels are offset, | ||
// can be toggled with StepObject "toggle_offset" | ||
} | ||
``` | ||
|
||
</details> | ||
|
||
#### Possible StepObjects | ||
|
||
<details> | ||
<summary>Objects JSON structure</summary> | ||
|
||
##### Condition | ||
A condition, which allows handling specific cases, can help add compatibility in some instances, such as certain models requiring certain steps if the skin is slim or wide. | ||
|
||
```json5 | ||
{ | ||
"type": "condition", | ||
|
||
"condition": String, // The condition to be used is required and may or may not have arguments (which go into "arguments"). | ||
// Possible values are: | ||
// | ||
// "is_slim_model": true if the selected skin is slim, false if it's wide. | ||
// More technically, it verifies if the LEFT_ARM + 15 skin at x and y has an alpha of 0. | ||
// Requires no arguments. | ||
//--- | ||
// "is_pixel": Compares if the pixel of an area is as expected. True if it's the same, false if it's different. | ||
// It has the following arguments: | ||
// | ||
// "pos": PointObject | ||
// "expected_color": string, // following the format of #AARRGGBB or #RRGGBB, for example #FF353635 | ||
//--- | ||
// "is_alpha": Compares if the alpha of the pixel of an area is as expected. True if it's within the range, | ||
// false if it's outside the range. The range is inclusive. | ||
// It has the following arguments: | ||
// | ||
// "pos": PointObject | ||
// "min_alpha": int, //value from 0 to 255 | ||
// "max_alpha": int, //value from 0 to 255 | ||
|
||
"arguments": Object, // The arguments required by "condition" are optional depending on whether | ||
// the option requires arguments or not. | ||
|
||
|
||
// "if_true" or "if_false" is required; there must be at least 1, both can be present. | ||
|
||
"if_true": StepObject[], // In case the condition is true | ||
|
||
"if_false": StepObject[] // In case the condition is false | ||
} | ||
``` | ||
|
||
##### Copy | ||
Copies an area from the selected texture and places it in the destination texture, possibly the step you'll use the most | ||
|
||
```json5 | ||
{ | ||
"type": "copy", | ||
|
||
"source": Area, // The area of the selected texture where the pixels will be copied | ||
|
||
"destination": Area, // The area of the final texture where the copied pixels will be placed, | ||
// this value is optional and if not specified, the same values of "source" will be used | ||
|
||
"add_hat_layer": boolean, // if true, it adds the first layer of the source in the destination | ||
// and adds the second layer of both, this value ignores "hat_layer" of source and destination, | ||
// this value is optional and by default is false | ||
|
||
"overlap_source_hat": boolean, // if true, it adds the first and second layer of the source in the destination, | ||
// this value ignores "hat_layer" of source, this value is optional and by default is false | ||
|
||
"degrees": int, // rotates the texture when placing it in the destination but rotating it from its center, | ||
// this value is optional and by default is 0 | ||
|
||
"mirror_horizontal": boolean, // applies a horizontal mirror to the copied texture, | ||
// it is applied after rotating with degrees, this value is optional and by default is false | ||
|
||
"mirror_vertical": boolean // applies a vertical mirror to the copied texture, | ||
// it is applied after rotating with degrees, this value is optional and by default is false | ||
} | ||
``` | ||
|
||
##### Delete | ||
Deletes pixels from the selected area in the final texture | ||
|
||
```json5 | ||
{ | ||
"type": "delete", | ||
"area": Area // the area where the pixels will be deleted | ||
} | ||
``` | ||
|
||
##### Fill color | ||
Fills an area with the selected color using the specified algorithm | ||
|
||
```json5 | ||
{ | ||
"type": "fill_color", | ||
|
||
"area": Area, // the area to be filled with the selected color | ||
|
||
"algorithm": String // the type of algorithm to be used to obtain the color, possible algorithms: | ||
// * desaturate: performs desaturation, converting the color to a grayscale scale. | ||
// It removes the color information from the pixel and retains only its luminance component | ||
// | ||
// * grayscale: similar to the desaturation algorithm, this method also converts the color to grayscale. | ||
// It uses a weighted average approach to calculate the grayscale value, which can yield slightly different | ||
// results than desaturation. | ||
// | ||
// * inverse: invert the color to use its opposite | ||
// | ||
// * solid: uses the selected color without modifying// | ||
// | ||
// * multiply: multiplies the selected color and the color of the pixel to be changed, | ||
// obtains a result more similar to the selected color if the selected pixel is in grayscale and is whiter | ||
} | ||
``` | ||
|
||
#### Function | ||
Use steps from another [Head models](#models), allowing for reuse, helping to avoid having steps with slight changes and repeated in other [Head models](#models). | ||
|
||
Extra notes: | ||
|
||
* The [selected destination](#select-destination) is passed, so changing it will affect what the function changes. | ||
* The [selected texture](#select-texture) is also passed, so changing it will make it the first texture that the function uses. | ||
* The same applies to the [selected color](#select-color). | ||
* If an [offset](#offsetobject) is passed, it will be passed in its current state to the previous Head models at the end of the function, which means that if you leave an offset enabled within your function, it will be applied to the next [step](#possible-stepobjects), even if that offset was not originally in the current model. | ||
|
||
```json5 | ||
{ | ||
"type": "function", | ||
|
||
"function_path": String, // Required, it's the other model that will be used, the initial path is | ||
// `assets/fzmm/fzmm_models`, so possible values might be: `internal/my_custom_function` or `heads/plushie1`, | ||
// note: no need to add .json | ||
|
||
"textures": TextureObject, // Optional, parameter that will be passed to the function, so it can use them | ||
|
||
"colors": ColorObject, // Optional, parameter that will be passed to the function, so it can use them | ||
|
||
"offsets": OffsetObject, // Optional, parameter that will be passed to the function, so it can use them, | ||
// at the end of the function they will be added to the current model | ||
|
||
"pos": PointObject, // Optional, offset that will be applied to the function, not affected by `inverted_left_and_right` | ||
|
||
"inverted_left_and_right": boolean // Optional, parameter that will be passed to the function, so it can use them | ||
} | ||
|
||
|
||
``` | ||
|
||
##### Select color | ||
Selects the color to be used in the next step, by default there is no color selected, the only color that can currently be modified via GUI is `selected_color`. White is used if no color is found | ||
|
||
```json5 | ||
{ | ||
"type": "select_color", | ||
"color_id": String // The id defined in colors | ||
} | ||
``` | ||
|
||
##### Select destination | ||
Select a texture that will be used in the following steps as the target of the modifications. The texture selected by default is the destination skin, its id is `destination_skin` | ||
|
||
```json5 | ||
{ | ||
"type": "select_destination", | ||
"texture_id": String // The id defined in textures | ||
} | ||
``` | ||
|
||
##### Select texture | ||
Selects a texture that will be used in the following steps. The default selected texture is the base skin, its id is `base_skin` | ||
|
||
```json5 | ||
{ | ||
"type": "select_texture", | ||
"texture_id": String // The id defined in textures | ||
} | ||
``` | ||
|
||
##### Toggle offset | ||
Step to enable or disable the offset, so that it only takes effect when you want it to, the offset is applied in the destination of all the steps to which it can be applied while it is enabled | ||
|
||
```json5 | ||
{ | ||
"type": "toggle_offset", | ||
|
||
"offset_id": String, // The id defined in offsets | ||
|
||
"enabled": boolean // new value | ||
} | ||
``` | ||
|
||
</details> | ||
|
||
#### Other objects | ||
|
||
<details> | ||
<summary>Objects JSON structure</summary> | ||
|
||
##### Area | ||
Represents an area in a Minecraft skin model, with information about its position, size, and whether it includes the hat layer or not | ||
|
||
```json5 | ||
{ | ||
"offset": String, // The offset of the area | ||
// Possible values are "HEAD", "BODY", "RIGHT_ARM", "RIGHT_LEG", "LEFT_LEG", "LEFT_ARM" | ||
// | ||
// Preconfigured values that do not require any other area attribute (x, y, etc.): | ||
// "ALL" (entire skin), "ALL_BODY" (entire skin excluding the head) | ||
|
||
"hat_layer": boolean, // // Whether the area is the hat layer | ||
|
||
"x": int, // The x coordinate of the top-left corner of the area | ||
|
||
"y": int, // The y coordinate of the top-left corner of the area | ||
|
||
"width": int, // The width of the area | ||
|
||
"height": int // The height of the area | ||
} | ||
``` | ||
|
||
##### PointObject | ||
Represents a point in a Minecraft skin model, with information about its position | ||
|
||
```json5 | ||
{ | ||
"offset": String, // The offset of the area | ||
// Possible values are "HEAD", "BODY", "RIGHT_ARM", "RIGHT_LEG", "LEFT_LEG", "LEFT_ARM" | ||
|
||
"hat_layer": boolean, // // Whether the area is the hat layer | ||
|
||
"x": int, // The x coordinate of the top-left corner of the area | ||
|
||
"y": int // The y coordinate of the top-left corner of the area | ||
} | ||
``` | ||
|
||
</details> | ||
|
||
#### Examples | ||
You can find examples of the models in: https://github.com/Zailer43/FZMM-Mod/tree/2df8caf9bfb55cb50db88b114ba871ab7ef6ccf3/src/main/resources/resourcepacks/fzmm_default_heads/assets/fzmm/fzmm_models | ||
|
||
--- | ||
|
||
## Q: Can I generate a head without internet? | ||
A: You can't, you need to have internet to access the mineskin API and send them the skin, so they upload it to a minecraft account, and then give you the value of the skin, you also need internet to load the skin. | ||
|
||
## Q: Can I speed up the generation of heads? | ||
A: You can do it by associating **your Google account** in [mineskin](https://mineskin.org/apikey) and entering your API Key in the mod configuration, it will make uploading skins **1-2 seconds faster** | ||
|
||
## Q: Where did you get the heads that the mod currently contains | ||
A: Mostly from [NameMC](https://namemc.com) and some from [Minecraft-Heads](https://minecraft-heads.com), I have cropped them and deleted the unnecessary pixels of the head |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.