Skip to content

TextureUtil block and biome coloring

Jesse Boyd edited this page Jun 16, 2017 · 2 revisions

Notes:

  • Put any jars with textures you want (e.g. your .minecraft/versions/<version>/<version>.jar) in FastAsyncWorldEdit/textures
  • Colors are represented as the RGB(A) color integer, it can be obtained with Color#getRGB()

Constructors

randomization = blocks will be randomized to have better local color instead of per pixel
Complexity is how much color variation is in a blocks texture e.g. quartz block = low, tnt = high
minComplexity, maxComplexity are percent values. For mc:1.11 I found 0, 73 suitable values

TextureUtil tu = Fawe.get().getCachedTextureUtil(randomization, minComplexity, maxComplexity)

For specific blocks we can use a FilteredTextureUtil, wrapped in a CachedTextureUtil

TextureUtil tu = new CachedTextureUtil(new FilteredTextureUtil(Fawe.get().getTextureUtil(), blocks))

Methods

Get the average color of a block

tu.getColor(BaseBlock block)

Get the nearest block to a color

tu.getNearestBlock(int color)

Alias for getNextNearestBlock(getColor(block))

tu.getNearestBlock(BaseBlock block)

Get the nearest block to a color - if it's an exact match, it returns the next nearest block

tu.getNextNearestBlock(int color)

Get the closest glass + block combination for a color.
It returns char { int glassCombinedId, int blockCombinedId }
The combinedId is (id << 4) + data, see FaweCache.getId(combined), FaweCache.getData(combined)

tu.getNearestLayer(int color)

Get the nearest block lighter than this

tu.getLighterBlock(BaseBlock block)

Get the nearest block lighter than this

tu.getDarkerBaseBlock block)

Get the BiomeColor object for a biome id
Get the biome id from the biome registry
BiomeRegistry biomeRegistry = FaweAPI.getWorld(worldName).getWorldData().getBiomeRegistry()

tu.getBiome(int biome)

Get the nearest BiomeColor object for a color

tu.getNearestBiome(int color)