Minecraft:Grass Block (Minecraft 4k): Difference between revisions
More actions
Sync: new page from Minecraft |
Sync: updated from Minecraft |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{Italic title|Minecraft 4k}} | |||
{{Exclusive|customtext=This feature is exclusive to ''[[Minecraft:Minecraft 4k]]''.|nocat=1}} | {{Exclusive|customtext=This feature is exclusive to ''[[Minecraft:Minecraft 4k]]''.|nocat=1}} | ||
{{Infobox | {{Infobox | ||
| title=Grass Block | |||
| image = 4k-2 Grass Block.png | | image = 4k-2 Grass Block.png | ||
| rows = | | rows = | ||
| Line 9: | Line 11: | ||
== Texture == | == Texture == | ||
[[File:Upscaled 4k grass side texture.png|thumb|right|The grass block's side texture if it was 512×512 instead of 16×16]] | [[File:Upscaled 4k grass side texture.png|thumb|right|The grass block's side texture if it was 512×512 instead of 16×16]] | ||
The texture for the Grass block was generated by the game at runtime (similarly to [[Minecraft:Procedural animated texture generation|what was done in Java Edition at that time for water and lava]]), rather than being stored inside of the jar as an image file. | The texture for the Grass block was generated by the game at runtime (similarly to [[Minecraft:Procedural animated texture generation|what was done in Java Edition at that time for water and lava]]), rather than being stored inside of the jar as an image file. | ||
As with all other block textures in Minecraft 4k, the grass block's textures are generated by going over every pixel in the texture left to right, top to bottom. | |||
For each texture, there is a value that will be called "subTexture". | |||
* subTexture = 0 is the top texture | |||
* subTexture = 1 is the side texture | |||
* subTexture = 2 is the bottom texture | |||
For each pixel, the game generates a new "randomVariation", which is calculated by subtracting a random value from 0 to 95 from 255, resulting in a random value between 160 and 255. | |||
After that, the game does the following algorithm to determine the current pixel's "color". | |||
# The game evaluates ((3x<sup>2</sup> + 81x) ÷ 4) & (i ÷ 4 − 1) where x and y are the "index" of the pixels; that is the amount of pixels from the left and topmost pixels respectively, and i is the size of the generated texture. (note that & represents a {{w|Bitwise_operation#AND|bitwise AND|newtab=1}}, and is responsible for keeping the grass color in roughly the top quarter of the block, as well as the pattern that it creates) The output of this operation will be called "grassCheck". | |||
# The game then takes the performs the following comparisons in order: | |||
#* If y + i × subTexture < grassCheck + {{frac|9|8}} i, it will set color to {{color|#6AAA40}} and proceed to the next step. (does not evaluate the next condition) | |||
#* If y + i × subTexture < grassCheck + {{frac|9|8}} i + 1, it will set randomVariation to {{frac|2|3}} randomVariation and proceed to the next step. This will "blend" the grass texture into the dirt texture by darkening the dirt below the grass. | |||
#** This will also cause the grass generation to fall through into the dirt's texture generator, which sets "color" to {{color|#966C4A}} | |||
#* If subTexture is 0, the first condition will always be met, and if subTexture is 2, both conditions will be not be met. | |||
# The game then creates a new value, that will be called "randomVariationWithBlockSideLight", where | |||
#* If subTexture = 2 (the bottom texture) set randomVariationWithBlockSideLight to randomVariation ÷ 2. | |||
#* Else, set randomVariationWithBlockSideLight to randomVariation. | |||
# The game multiplies each of "color"'s RGB channels by randomVariationWithBlockSideLight to get the final RGBA color of the pixel on the texture.<ref>https://github.com/NeRdTheNed/MC-TextureGen/blob/main/mc-texture-gen-impl/src/main/java/com/github/nerdthened/mctexturegen/generators/MC4k2Generator.java</ref> | |||
== Data values == | == Data values == | ||
| Line 34: | Line 53: | ||
== Gallery == | == Gallery == | ||
=== Textures === | === Textures === | ||
<gallery> | <gallery class="pixel-image"> | ||
4k-2 Grass Block (top texture).png|Top texture | 4k-2 Grass Block (top texture).png|Top texture | ||
4k-2 Grass Block (side texture).png|Side texture | 4k-2 Grass Block (side texture).png|Side texture | ||
Latest revision as of 11:07, 30 August 2026
Template:Italic title Template:Exclusive Template:Infobox In Minecraft:Minecraft 4k, the grass block has a block ID of 1. It was originally the Minecraft:XOR Block. Unlike normal Minecraft:Minecraft, grass blocks do not turn into dirt when a block is placed above it.
Texture
The texture for the Grass block was generated by the game at runtime (similarly to what was done in Java Edition at that time for water and lava), rather than being stored inside of the jar as an image file.
As with all other block textures in Minecraft 4k, the grass block's textures are generated by going over every pixel in the texture left to right, top to bottom.
For each texture, there is a value that will be called "subTexture".
- subTexture = 0 is the top texture
- subTexture = 1 is the side texture
- subTexture = 2 is the bottom texture
For each pixel, the game generates a new "randomVariation", which is calculated by subtracting a random value from 0 to 95 from 255, resulting in a random value between 160 and 255.
After that, the game does the following algorithm to determine the current pixel's "color".
- The game evaluates ((3x2 + 81x) ÷ 4) & (i ÷ 4 − 1) where x and y are the "index" of the pixels; that is the amount of pixels from the left and topmost pixels respectively, and i is the size of the generated texture. (note that & represents a Template:W, and is responsible for keeping the grass color in roughly the top quarter of the block, as well as the pattern that it creates) The output of this operation will be called "grassCheck".
- The game then takes the performs the following comparisons in order:
- If y + i × subTexture < grassCheck + Template:Frac i, it will set color to Template:Color and proceed to the next step. (does not evaluate the next condition)
- If y + i × subTexture < grassCheck + Template:Frac i + 1, it will set randomVariation to Template:Frac randomVariation and proceed to the next step. This will "blend" the grass texture into the dirt texture by darkening the dirt below the grass.
- This will also cause the grass generation to fall through into the dirt's texture generator, which sets "color" to Template:Color
- If subTexture is 0, the first condition will always be met, and if subTexture is 2, both conditions will be not be met.
- The game then creates a new value, that will be called "randomVariationWithBlockSideLight", where
- If subTexture = 2 (the bottom texture) set randomVariationWithBlockSideLight to randomVariation ÷ 2.
- Else, set randomVariationWithBlockSideLight to randomVariation.
- The game multiplies each of "color"'s RGB channels by randomVariationWithBlockSideLight to get the final RGBA color of the pixel on the texture.<ref>https://github.com/NeRdTheNed/MC-TextureGen/blob/main/mc-texture-gen-impl/src/main/java/com/github/nerdthened/mctexturegen/generators/MC4k2Generator.java</ref>
Data values
ID
History
Gallery
Textures
-
Top texture
-
Side texture
-
Bottom texture