Using reusable textures for mods instead of hardcoded ones.
It's data-driven.
So, you can modify the textures generated with the resource pack.
Also, add compatibility to any mod with any resource packs.
For JSON
example: https://github.com/SettingDust/DynamicTextures/tree/main/mod/src/main/generated/assets/dynamic-textures/dynamic_texture/modifier
Runes
Lazy
Farmer's Delight
Lazy
Pack It Up
Lazy
Illager Invasion
Lazy
- You need a tool that can show you the sizes of elements you need on the image.
- You can reload the resource to see the changes.
- I will explain the built-in jsons here.
-
https://github.com/SettingDust/DynamicTextures/blob/main/mod/src/main/generated/assets/dynamic-textures/dynamic_texture/modifier/spell_engine/spell_binding.json
-
- Loading this texture modifier when the mod is loaded.
- Texture modifier is for modify the target texture for generating the texture dynamically. It's the main part of this mod.
-
- Define the size of the texture. Isn't required when specified
targetTexture
. - When there isn't
targetTexture
. It will generate a texture with only transparent pixels.
- Define the size of the texture. Isn't required when specified
-
- The path for generated texture. Isn't required when specified
size
. - We need the original texture to find out what modifiers we need.
- Open the jar of mod and find out the png file path
is
spell_engine-0.12.4_1.20.1.jar!\assets\spell_engine\textures\gui\spell_binding.png
- So we know the texture's resource location
is
spell_engine:gui/spell_binding
. It's the location of thetargetTexture
we need.
- The path for generated texture. Isn't required when specified
-
- An array of modifiers that will apply to the raw texture.
-
- Remove border from the texture
- The values here removed the border of the gui background.
rect
- The target rect you need at the texture.
- The value here means we selected the gui background.
border
- An object that holds two sizes that confirms the size of the borders.
first
- The size of the top and left border. That is, the distance between the inner edge of the frame and the left and top edges.
second
- The size of the bottom and right border. That is, the distance between the inner edge of the frame and the right and bottom edges.
-
- Remove specific color from specific rect.
- The values here removed background color from the gui.
color
- A ARGB color.
ffc6c6c6
is the background color of gui
-
- Copy a rect on source texture onto specific rect.
sourceTexture
- A resource location of texture
dynamic-textures:dynamic_texture/defined/inventory/bottom
is an defined texture that will generate runtime for matching the resource pack. You can add your own defined texture.
fromRect
It's all content from source texture by default. So, emit here.targetRect
- The copy target
- The values here are targeting the bottom part of the gui that contains the player inventory.
-
- Remove target rect from current texture
rect
The values here removed the left slot on the top part of the gui
-
- The values here removed the border of the right slot on the gui
-
- The values here removed the background of the right slot.
-
- A bit complex. It's blending the result of sourceTextures with current texture
- The values here make the current texture blend with the defined abreast slots
onExisting
Only blend the pixel alpha not 0 when true. Default is falseinvert
- If false, source texture on current texture. If true, current texture on source texture. Default is false.
- For display the icon in the slot. It's true here.
sourceTextures
An array of textures to blend. Applying by order. The properties are as same as the root object.
-
- Replace the enchanting elements background of the gui on the texture
-
- The values applied the default background of the enchanting elements on the right of the gui in the texture
-
- Replace the statuses on the texture
-
- Blend the inventory top background with current texture
sourceTextures.modifiers
dynamic-textures:copy_nine_patch
- Copy the source texture with nine patch to avoid stretch.
sourceRect
default is the whole texture.repeat
default is false.
-