Skip to content

Commit

Permalink
Merge pull request #993 from Bedrock-OSS/texture-atlas-namespacing
Browse files Browse the repository at this point in the history
Add namespace to texture atlas shortnames
  • Loading branch information
QuazChick authored Feb 5, 2025
2 parents 089d73d + cb446da commit ef789e8
Show file tree
Hide file tree
Showing 26 changed files with 588 additions and 562 deletions.
2 changes: 1 addition & 1 deletion docs/blocks/applying-effects.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ And done! The code above will trigger the desired status effect as long as the e
"minecraft:geometry": "geometry.wither_block",
"minecraft:material_instances": {
"*": {
"texture": "wither_block"
"texture": "wiki:wither_block"
}
},
"minecraft:custom_components": ["wiki:detect_treaders"]
Expand Down
140 changes: 70 additions & 70 deletions docs/blocks/block-components.md

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/blocks/block-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Textures can be created in Blockbench by clicking `Create Texture` and selecting

The "paper_bag" model has multiple pre-made textures, listed below:

- `textures/blocks/paper_bag.png`
- `textures/blocks/paper_bag.png`

<WikiImage
src="/assets/images/blocks/block-models/paper_bag.png"
Expand All @@ -79,7 +79,7 @@ The "paper_bag" model has multiple pre-made textures, listed below:
width="128"
/>

- `textures/blocks/paper_bag_bottom_fold.png`
- `textures/blocks/paper_bag_bottom_fold.png`

<WikiImage
src="/assets/images/blocks/block-models/paper_bag_bottom_fold.png"
Expand All @@ -88,7 +88,7 @@ The "paper_bag" model has multiple pre-made textures, listed below:
width="128"
/>

- `textures/blocks/paper_bag_side_gusset.png`
- `textures/blocks/paper_bag_side_gusset.png`

<WikiImage
src="/assets/images/blocks/block-models/paper_bag_side_gusset.png"
Expand Down Expand Up @@ -155,16 +155,16 @@ If you have textures for your block defined in that file, make sure you migrate
// Apply textures and other rendering configuration
"minecraft:material_instances": {
"*": {
"texture": "paper_bag",
"texture": "wiki:paper_bag",
"render_method": "alpha_test" // Disable backface culling and allow transparency
},
"down": {
"texture": "paper_bag_bottom_fold",
"texture": "wiki:paper_bag_bottom_fold",
"render_method": "alpha_test" // Must be the same in all instances
},
// Custom instance name used in model
"side_gusset": {
"texture": "paper_bag_side_gusset",
"texture": "wiki:paper_bag_side_gusset",
"render_method": "alpha_test" // Must be the same in all instances
}
},
Expand Down
10 changes: 5 additions & 5 deletions docs/blocks/block-texture-variation.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Block texture variation is when a block type can have multiple textures that are

**Issues:**

- Variations referencing texture set files do not use the defined heightmap, MER or normal map files ([MCPE-126617](https://bugs.mojang.com/browse/MCPE-126617)).
- Variations referencing texture set files do not use the defined heightmap, MER or normal map files ([MCPE-126617](https://bugs.mojang.com/browse/MCPE-126617)).

## Applying Texture Variation

Expand All @@ -31,9 +31,9 @@ This file contains a list of block textures. Variated block textures have a `var

This is an example of how to create 3 texture variations for the vanilla dirt block:

- Create or modify three dirt textures, name them `dirt0.png`, `dirt1.png`, and `dirt2.png`.
- Copy the `dirt0.png`, `dirt1.png`, and `dirt2.png` to the location noted in the path variable. This could contain additional folders if you want to be orderly.
- Add the following to dirt's texture entry:
- Create or modify three dirt textures, name them `dirt0.png`, `dirt1.png`, and `dirt2.png`.
- Copy the `dirt0.png`, `dirt1.png`, and `dirt2.png` to the location noted in the path variable. This could contain additional folders if you want to be orderly.
- Add the following to dirt's texture entry:

<CodeHeader>RP/textures/terrain_texture.json</CodeHeader>

Expand All @@ -59,7 +59,7 @@ This is an example of how to create 3 texture variations for the vanilla dirt bl

## Weighted Texture Variation

After using the example above, you might want to adjust the weights, edit the `terrain_textures.json` to include a weight field as shown below.
After using the example above, you might want to adjust the weights, edit the `terrain_texture.json` to include a weight field as shown below.

To calculate how likely a texture variation is, add all of the weights together (in this case 70 + 20 + 10 = 100) and divide the weight by this total. For example, the probability of the `dirt0` variation being chosen is 70 &div; 100, so 70% of positions in the world will display `dirt0` if dirt is placed there.

Expand Down
4 changes: 2 additions & 2 deletions docs/blocks/blocks-as-items.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ One example of a situation where replacing the block item is necessary is with f
"minecraft:geometry": "minecraft:geometry.cross",
"minecraft:material_instances": {
"*": {
"texture": "daffodil",
"texture": "wiki:daffodil",
"render_method": "alpha_test"
}
}
Expand All @@ -66,7 +66,7 @@ One example of a situation where replacing the block item is necessary is with f
}
},
"components": {
"minecraft:icon": "daffodil",
"minecraft:icon": "wiki:daffodil",
"minecraft:block_placer": {
"block": "wiki:daffodil",
"replace_block_item": true
Expand Down
82 changes: 43 additions & 39 deletions docs/blocks/blocks-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ Below is the **minimum** behavior-side code to get a custom block into the creat

### Block Description

- Defines the block's `identifier` - a unique ID in the format of `namespace:identifier`.
- Configures which `menu_category` the block is placed into.
- Also takes the optional parameters `group` and `is_hidden_in_commands`.
- Defines the block's `identifier` - a unique ID in the format of `namespace:identifier`.
- Configures which `menu_category` the block is placed into.
- Also takes the optional parameters `group` and `is_hidden_in_commands`.

_The block description is also home to [states](/blocks/block-states) and [traits](/blocks/block-traits), which are covered in their own pages._

Expand Down Expand Up @@ -107,13 +107,13 @@ Let's configure our own functionality!
}
```

- [`minecraft:destructible_by_mining`](/blocks/block-components#destructible-by-mining) defines how long the player will need to mine the block until it breaks. Currently, it isn't possible to set different destroy times for different tools.
- [`minecraft:destructible_by_explosion`](/blocks/block-components#destructible-by-explosion) defines the resistance to explosions. The higher the value, the lower the chance of destruction.
- [`minecraft:friction`](/blocks/block-components#friction) defines how much friction the block has. For example, soul sand has a high value for friction, so it slows the players. Ice has a lower friction value, so it has a slippery effect. The friction of classic blocks such as wood or stone is `0.4`.
- [`minecraft:map_color`](/blocks/block-components#map-color) is the hex color code that will be displayed on a Minecraft map to represent this block. `#ffffff` means white. You can get hex codes for other colors [here](https://www.google.com/search?q=hex+color+picker).
- [`minecraft:light_dampening`](/blocks/block-components#light-dampening) defines how much light will be blocked from passing through.
- [`minecraft:light_emission`](/blocks/block-components#light-emission) defines the light level the block will output.
- [`minecraft:loot`](/blocks/block-components#loot) defines a loot table path for the block to drop. If this is removed, then the block will drop itself. You can learn more about loot tables [here](/loot/loot-tables).
- [`minecraft:destructible_by_mining`](/blocks/block-components#destructible-by-mining) defines how long the player will need to mine the block until it breaks. Currently, it isn't possible to set different destroy times for different tools.
- [`minecraft:destructible_by_explosion`](/blocks/block-components#destructible-by-explosion) defines the resistance to explosions. The higher the value, the lower the chance of destruction.
- [`minecraft:friction`](/blocks/block-components#friction) defines how much friction the block has. For example, soul sand has a high value for friction, so it slows the players. Ice has a lower friction value, so it has a slippery effect. The friction of classic blocks such as wood or stone is `0.4`.
- [`minecraft:map_color`](/blocks/block-components#map-color) is the hex color code that will be displayed on a Minecraft map to represent this block. `#ffffff` means white. You can get hex codes for other colors [here](https://www.google.com/search?q=hex+color+picker).
- [`minecraft:light_dampening`](/blocks/block-components#light-dampening) defines how much light will be blocked from passing through.
- [`minecraft:light_emission`](/blocks/block-components#light-emission) defines the light level the block will output.
- [`minecraft:loot`](/blocks/block-components#loot) defines a loot table path for the block to drop. If this is removed, then the block will drop itself. You can learn more about loot tables [here](/loot/loot-tables).

_Browse more block components [here](/blocks/block-components)!_

Expand Down Expand Up @@ -154,7 +154,7 @@ Now, we need to link the texture shortname to an image file path in `RP/textures
"num_mip_levels": 4, // Quality of texture when viewed from a distance or at an angle
"texture_data": {
// Our texture shortname:
"custom_block": {
"wiki:custom_block": {
"textures": "textures/blocks/custom_block" // Link to an image file name
}
}
Expand All @@ -165,43 +165,47 @@ Now, we need to link the texture shortname to an image file path in `RP/textures

Textures can also be applied per face. For example, a custom "compass block" could use the following ✨stunning✨ textures:

- `textures/blocks/compass_block_down.png`
- `textures/blocks/compass_block_down.png`

<WikiImage
src="/assets/images/blocks/blocks-intro/compass_block_down.png"
pixelated
width="64"
/>

- `textures/blocks/compass_block_up.png`
- `textures/blocks/compass_block_up.png`

<WikiImage src="/assets/images/blocks/blocks-intro/compass_block_up.png" pixelated width="64" />
<WikiImage
src="/assets/images/blocks/blocks-intro/compass_block_up.png"
pixelated
width="64"
/>

- `textures/blocks/compass_block_north.png`
- `textures/blocks/compass_block_north.png`

<WikiImage
src="/assets/images/blocks/blocks-intro/compass_block_north.png"
pixelated
width="64"
/>

- `textures/blocks/compass_block_east.png`
- `textures/blocks/compass_block_east.png`

<WikiImage
src="/assets/images/blocks/blocks-intro/compass_block_east.png"
pixelated
width="64"
/>

- `textures/blocks/compass_block_south.png`
- `textures/blocks/compass_block_south.png`

<WikiImage
src="/assets/images/blocks/blocks-intro/compass_block_south.png"
pixelated
width="64"
/>

- `textures/blocks/compass_block_west.png`
- `textures/blocks/compass_block_west.png`

<WikiImage
src="/assets/images/blocks/blocks-intro/compass_block_west.png"
Expand All @@ -218,12 +222,12 @@ The `blocks.json` entry would look like this:
"format_version": "1.21.40",
"wiki:compass_block": {
"textures": {
"down": "compass_block_down",
"up": "compass_block_up",
"north": "compass_block_north",
"east": "compass_block_east",
"south": "compass_block_south",
"west": "compass_block_west"
"down": "wiki:compass_block_down",
"up": "wiki:compass_block_up",
"north": "wiki:compass_block_north",
"east": "wiki:compass_block_east",
"south": "wiki:compass_block_south",
"west": "wiki:compass_block_west"
}
}
}
Expand All @@ -236,22 +240,22 @@ Or, if you're using [material instances](/blocks/block-components#material-insta
```json
"minecraft:material_instances": {
"*": {
"texture": "compass_block_down" // This texture appears in destruction particles
"texture": "wiki:compass_block_down" // This texture appears in destruction particles
},
"up": {
"texture": "compass_block_up"
"texture": "wiki:compass_block_up"
},
"north": {
"texture": "compass_block_north"
"texture": "wiki:compass_block_north"
},
"east": {
"texture": "compass_block_east"
"texture": "wiki:compass_block_east"
},
"south": {
"texture": "compass_block_south"
"texture": "wiki:compass_block_south"
},
"west": {
"texture": "compass_block_west"
"texture": "wiki:compass_block_west"
}
}
```
Expand All @@ -267,22 +271,22 @@ With the following `terrain_texture.json` data:
"padding": 8,
"num_mip_levels": 4,
"texture_data": {
"compass_block_down": {
"wiki:compass_block_down": {
"textures": "textures/blocks/compass_block_down"
},
"compass_block_up": {
"wiki:compass_block_up": {
"textures": "textures/blocks/compass_block_up"
},
"compass_block_north": {
"wiki:compass_block_north": {
"textures": "textures/blocks/compass_block_north"
},
"compass_block_east": {
"wiki:compass_block_east": {
"textures": "textures/blocks/compass_block_east"
},
"compass_block_west": {
"wiki:compass_block_west": {
"textures": "textures/blocks/compass_block_west"
},
"compass_block_south": {
"wiki:compass_block_south": {
"textures": "textures/blocks/compass_block_south"
}
}
Expand All @@ -306,9 +310,9 @@ You can learn more about translation [here](/concepts/text-and-translations).

In this page, you've learnt about the following:

- [x] Basic features of blocks
- [x] How to apply a texture to all block faces
- [x] How to apply textures per face
- [x] Basic features of blocks
- [x] How to apply a texture to all block faces
- [x] How to apply textures per face

...but it's only the beginning, see what else you could do below!

Expand Down
Loading

0 comments on commit ef789e8

Please sign in to comment.