Block Properties Modifiers - MehVahdJukaar/polytone GitHub Wiki
Using a Block Modifiers file, you will be able to change many features of a specific Blocks such as:
- Sound
- Model Tint (Colormap)
- Render Offset
- Map Color
- Particle Emission
- Sound Emission
First you'll need to create a .json file in your resource pack folder in assets/[block namespace]/polytone/block_modifiers/[block name].json.
Say for example the block you want to edit is create:deployer, then the file will be assets/create/polytone/block_modifiers/deployer.json
Alternatively, if you want to manually specify your targets blocks, or need to target more than one, you can place this json in assets/[your pack namespace]/polytone/block_modifiers/[some name].json (Any path will work but this is recommended to avoid overwriting Implicit defined targets).
Useful if you want yo modify more than 1 target for the same json.
Then you can add the targets field containing a list of valid block ids or a tag to the json as follows:
{
"targets": ["minecraft:stone", "minecraft:andesite"]
}or
{
"targets": "#minecraft:leaves"
}Here's how one of this files could look like (uses implicit targeting, json at assets/minecraft/polytone/block_modifiers/dirt.json):
{
"sound_type": "stone",
"map_color": "gold",
"colormap": "minecraft:foliage_color",
"offset_type": "xyz"
}These are the valid top level keys you can use:
targetssound_typemap_colorcolormapoffset_typeparticle_emitterssound_emittersblock_set_typerender_typecan_occludespawn_particles_on_breaktinted_breaking_particlesdisable_particles
Below we'll see in detail what each of them does and how to use them.
To alter the sound of a block to an existing Sound Type simply add the string "sound_type": "[sound type name]".
The resoulting file could look like this:
{
"sound_type": "sculk"
}Here is a list of existing vanilla Sound Types:
VANILLA SOUND TYPES
| Sound Type Name |
|---|
| empty |
| wood |
| gravel |
| grass |
| lily_pad |
| metal |
| stone |
| glass |
| wool |
| sand |
| snow |
| powder_snow |
| ladder |
| anvil |
| slime_block |
| honey_block |
| wet_grass |
| coral_block |
| bamboo |
| bamboo_sapling |
| scaffolding |
| sweet_berry_bush |
| crop |
| hard_crop |
| vine |
| nether_wart |
| lantern |
| stem |
| nylium |
| fungus |
| roots |
| shroomlight |
| weeping_vines |
| twisting_vines |
| soul_sand |
| soul_soil |
| basalt |
| wart_block |
| netherrack |
| nether_bricks |
| nether_sprouts |
| nether_ore |
| bone_block |
| netherite_block |
| ancient_debris |
| lodestone |
| chain |
| nether_gold_ore |
| gilded_blackstone |
| candle |
| amethyst |
| amethyst_cluster |
| small_amethyst_bud |
| medium_amethyst_bud |
| large_amethyst_bud |
| tuff |
| calcite |
| dripstone_block |
| pointed_dripstone |
| copper |
| cave_vines |
| spore_blossom |
| azalea |
| flowering_azalea |
| moss_carpet |
| pink_petals |
| moss |
| big_dripleaf |
| small_dripleaf |
| rooted_dirt |
| hanging_roots |
| azalea_leaves |
| sculk_sensor |
| sculk_catalyst |
| sculk |
| sculk_vein |
| sculk_shrieker |
| glow_lichen |
| deepslate |
| deepslate_bricks |
| deepslate_tiles |
| polished_deepslate |
| froglight |
| frogspawn |
| muddy_mangrove_roots |
| mud |
| mud_bricks |
| packed_mud |
| hanging_sign |
| nether_wood_hanging_sign |
| bamboo_wood_hanging_sign |
| bamboo_wood |
| nether_wood |
| cherry_wood |
| cherry_sapling |
| cherry_leaves |
| cherry_wood_hanging_sign |
| chiseled_bookshelf |
| suspicious_sand |
| suspicious_gravel |
| decorated_pot |
| decorated_pot_cracked |
You can also define your own Sound Types. To do so you'll have to consult the minecraft wiki for a list of existing Sound Events or use the playsound command auto suggestion feature.
Note that to add NEW Sound Events (aka you want to add a new .ogg file), you can refer to the Custom Sound Events Page.
Once you have choosen your Sound Events you can add them to the block by adding a break_sound, place_sound, hit_sound, fall_sound and step_sound field as follows.
You'll also be able to specify a volume and pitch, thought these two are optional
{
"sound_type": {
"break_sound": "block.wet_grass.break",
"place_sound": "entity.witch.death",
"hit_sound": "minecraft:wet_grass.break",
"step_sound": "block.bamboo.step",
"fall_sound": "block.bamboo.step",
"pitch": 1,
"volume": 1
}
}If you are feeling lazy you can also input a name of a Block and it will work in Copy Mode using the function copy().
For example this will copy whatever sound the Brewing Stand has:
{
"sound_type": "copy(minecraft:brewing_stand)"
}If you are feeling fancy and would like to not define a new Sound Types each time, you can also define that sound_type block in the assets/[your pack namespace]/polytone/custom_sound_types/[your sound type name].json folder.
The file you'll place there could be as follows:
{
"break_sound": "block.wet_grass.break",
"place_sound": "entity.witch.death",
"hit_sound": "minecraft:wet_grass.break",
"fall_sound": "block.bamboo.step",
"step_sound": "block.bamboo.step"
}Then inside your Block Property file you'll be able to reference it using "[your pack name]:[your sound type name]", as follows:
{
"sound_type": "my_awesome_resource_pack:my_sound_event"
}This feature is only relevant to Door, Trapdoors, Pressure Plates and Buttons.
A BlockSetType is a category of sound events that vanilla assigns to each of the above mentioned blocks. This includes sound events such as door open, button push and such.
By changing it we can thus modify those non-standard sounds that these specific blocks have. Note that this should work for modded blocks too but wether it does its up to the mod itself.
There are two ways to modify a BlockSetType:
By reference:
{
"block_set_type": "minecraft:cherry"
}In this case we are referencing the vanilla cherry wood BlockSetType. Other existing BlockSetTypes wont be listed but you can figure them out as they matcht he existing vanilla doors. Usig the By Reference method we can also reference our own Custom BlockSetTypes (explained below), using their Ids, similar to what explained above for SoundEvents.
By Inlining a BlockSetType definition:
{
"block_set_type": {
"door_open": "minecraft:ambient.cave",
"door_close": "minecraft:ambient.cave"
}
}The parameters this definition takes are:
door_open, door_close, trapdoor_close, trapdoor_open, pressure_plate_click_off, pressure_plate_click_on, button_click_off, button_click_on
In this case we are definint a new BlockSetType just for our block.
If you are feeling fancy and would like to not define a new BlockSetTypes each time, you can also define that block_set_type block in the assets/[your pack namespace]/polytone/custom_block_sets/[your block set type name].json folder.
The file you'll place there could be as follows:
{
"door_open": "minecraft:ambient.cave",
"door_close": "minecraft:ambient.cave"
}You can then Reference it in one or more block_modifiers files as explain above by using its ID.
REMINDER: Polytone allows to register Custom SoundEvents. Use that if you want to say modify the door open sound to a new sound. Refer to that section for more info.
tinted_breaking_particles will make tint apply or not apply to break particles. In vanilla this is normally handled by giving a block a colormap that yeilds a white color on tint_index 0. This works for all blocks EXCEPT for grass_block which is hardcoded to NEVER have tint no matter the colormap.°
Use this field to remove that restriction.
spawn_particles_on_break is self explanatory while disable_particles will block the target from emitting existing particles. For example toch flame for torches.
With this feature you can make a block spawn particles just like a torch would.
You'll be able to do so by adding the particle_emitters field as follows:
{
"particle_emitters": [
{
"particle": "minecraft:flame",
"chance": "0.2",
"x": "cos(TIME)+0.5",
"z": "cos(TIME)+0.5",
"y": "1",
"dx": "0",
"dy": "0.001 + rand()*0.001",
"dz": "0",
"state_predicate": {
"predicate_type": "minecraft:always_true"
}
}
]
}In this example we are creating a flame particle right above the target block in a circle pattern, rotating with time around its circumference.
As you can see each emitter will have to contain all the fields listed above. These directly control the type of particle and its parameters at every tick. The value of each parameter is a Block Expression. Refer to the Scripting Section for more info.
Here is a table explaining in more detail what each of the parameters do. Most parameters are optional.
| Parameter | Description | Type |
|---|---|---|
particle |
Id of the target Particle Type you want to spawn | String |
chance |
Chance that this particle will be spawned | Block Expression |
count |
How many paticles to spawn | Block Expression |
x |
Particle x position, relative to spawn_location | Block Expression |
y |
Particle y position, relative to spawn_location | Block Expression |
z |
Particle z position, relative to spawn_location | Block Expression |
dx |
Particle x velocity | Block Expression |
dy |
Particle y velocity | Block Expression |
dz |
Particle z velocity | Block Expression |
red |
Particle red | Particle Expression. Only works on custom particles |
green |
Particle green | Particle Expression. Only works on custom particles |
blue |
Particle blue | Particle Expression. Only works on custom particles |
alpha |
Particle alpha | Particle Expression. Only works on custom particles |
roll |
Particle roll | Particle Expression. Only works on custom particles |
size |
Particle size | Particle Expression. Only works on custom particles |
custom |
Particle custom | Particle Expression. Only works on custom particles |
tick_source |
What spawns the particle | Can be animate_tick (default), block_broken or block_cracking
|
state_predicate |
Additional Rule Test object to filter the given blockstate. Check out official MC wiki on Rule Tests | always true test |
biomes |
List of biomes ids or biome tags or just biome tag (Holder set) where these can spawn | String list |
spawn_location |
Where, on the block the particle will spawn | Can be lower_corner, center, block_faces. Default is center
|
Note that what each particle do with the last 3 parameters (dx,dy,dz) is up to their own classes and may not equal their velocity all the time. Some for example might just use one for different purpose like noteblock particles that for example use dx for the note color. Refer to the Minecraft Wiki for more info on this.
Sound emission works very similar to particle emission. Just like that one you will need to be in particle ticking range for it to trigger.
You can start by adding a sound_emitters field as in the following example:
{
"sound_emitters": [
{
"sound": "my_pack:my_custom_sound",
"chance": "rand()*0.3",
"pitch": "0.2+gaussian()*0.3"
}
]
}Here are all the parameters on an emitter.
| Parameter | Description | Type |
|---|---|---|
sound |
ID of the sound event to play | String |
chance |
Chance that this sound will be spawned | Block Expression |
x |
Sound x position | Block Expression |
y |
Sound y position | Block Expression |
z |
Sound z position | Block Expression |
pitch |
Sound Pitch | Block Expression |
volume |
Sound Volume | Block Expression |
distance_delay |
Wether this sound is delayed the further you are (like fireworks) | Boolean |
biomes |
List of biomes ids or biome tags or just biome tag (Holder set) where these can spawn | String list |
state_predicate |
Additional Rule Test object to filter the given blockstate. Check out official MC wiki on Rule Tests | always true test |
Block Offset determines the position at which the block will be rendered in world. It is used by blocks such as tall grass and flower to offset the position randomly depending on the position where it is.
Its accepted values are: none, xz, xyz
As an example to change minecraft:sugar_cane to have an offset on xz axis you would use
{
"offset_type": "xz"
}Additionally to pre made values one can also add customvalues, altering how much the block is offset in each axis.
{
"offset_type": {
"max_y": 0.5,
"max_z": 0
}
}This feature is (mainly) Fabric only as forge already has no need for it since you can change it very similarly inside your block models json files.
Render Types can be one of the following cutout, solid, translucent. If you are looking at this you likely want to set it to cutout for blocks with non solid textures or overlays.
{
"render_type": "cutout"
}This is a simple true | false boolean that determines if the block can hide nearby block faces. Experimental, might alter behavior of some blocks in single player. Use with care.
Not to be confused with Colormaps or color.properties, adding the map_color property allows to change the Map Color of a specific block.
To know the name of a Map Color simply refer to the table in the Map Colors/Custom Colors section of this wiki and remove the map. prefix.
Here is an example where we change a block Map Color to use the plant map color:
{
"map_color": "plant"
}Colormaps allow you to define custom Tint for your block models.
To be active your block models would need the "tintindex" = [tint] line in their model file. They can use multiple Tint Indexes too!
Colormaps use a separate folder to be defined as they are a concept that works INDIPENDENT of blocks as it can be used by fluids particles and more.
To Link a colormap to a block you will however need to add the colormap field to your Block Properties. For more info refer to the dedicated Colormaps Page.
There are 4 ways you can do this. Link an existing colormap (recommended), inline a new colormap, implicit colormap and single color colormap.
Here's an example, referencing one of the built-in colormaps:
{
"colormap": "minecraft:foliage_color"
}That colormap used is one of the builtin one (see colormap section). You can instead replace it with your colormap resource location referencing to the one you created in the /colormaps folder
Here's a random colormap with a random sampler. See Colormaps section for more info
{
"colormap": {
"default_color": 1,
"x_axis": "0.5+cos(POS_X*0.2)",
"y_axis": "TEMPERATURE"
}
}If you JUST wish to add a colormap to a block you can omit the .json configuration file entirely and simply place a colormap .png with the right name in /block_modifiers.
Refer to the Colormap section for more
For example if you just want to assign a simple colormap to the supplementaries:checker_block block, you would simply add a texture at assets/supplementaries/polytone/block_modifiers/checker_block.png
This will internally create a simple Block Property object containing a new simple Colormap using the vanilla temperature/humidify sampler and assign it to that specific block.
This one should not be used really. Just recolor your textures instead. Only real use case is if you want to save space on high res texture packs Color given is in decimal format.
{
"colormap": 77777
}Finally if you happen to have a block with multiple tint indexes you can have multiple colormaps as Compound Colormap as follows (refer to Colormap section for more detailed info)
{
"colormap": {
"0": 77777,
"1": "minecraft:grass_color"
}
}