Package com.fastasyncworldedit.core.util
Class TextureUtil
java.lang.Object
com.fastasyncworldedit.core.util.TextureUtil
- All Implemented Interfaces:
TextureHolder
- Direct Known Subclasses:
CleanTextureUtil,DelegateTextureUtil,FilteredTextureUtil
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int[]protected long[]protected long[]protected TextureUtil.BiomeColor[]https://github.com/erich666/Mineways/blob/master/Win/biomes.cppprotected int[]protected int[]protected int[][]protected int[]protected int[]protected long[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intaverageColor(int... colors) Combine multiple colors by multiplingstatic intaverageColor(int c1, int c2) Combine two colors by averagingprotected voidprotected static longcolorDistance(int c1, int c2) static intcombineTransparency(int top, int bottom) Assumes the top layer is a transparent color and the bottom is opaquefork()Create a copy of thisTextureUtilinstance if required for thread safety.static TextureUtilfromBlocks(Set<BlockType> blocks) static TextureUtilfromClipboard(Clipboard clipboard) static TextureUtilgetBiome(int biome) Get theTextureUtil.BiomeColorentry from a biome's IDprotected intgetBiomeMix(int[] biomeIdsOutput, int color) intGet the integer representation of a biomes's RGBA color when applied to grass.intGet the integer representation of a block's RGBA color.getDarkerBlock(int color) Get the next darkest blockgetDarkerBlock(BlockType block) Get the next darkest blockprotected Fileprotected booleangetIsBlockCloserThanBiome(char[] blockAndBiomeIdOutput, int color, int biomePriority) getLighterBlock(int color) Get the next lightest blockgetLighterBlock(BlockType block) Get the next lightest blockgetNearestBiome(int color) Get the biome most closely matching a color based on the block's average colorgetNearestBlock(int color) Get the block most closely matching a color based on the block's average colorprotected BlockTypegetNearestBlock(int color, boolean darker) protected BlockTypegetNearestBlock(BlockType block, boolean darker) getNearestLayer(int color) Returns the block combined ids as an array.getNextNearestBlock(int color) Get the block most closely matching a color, without matching the color, based on the block's average colorint[]protected booleanhasAlpha(int color) protected static inthueDistance(int red1, int green1, int blue1, int red2, int green2, int blue2) voidstatic intmultiplyColor(int c1, int c2) Combine two colors by multipling
-
Field Details
-
blockColors
protected int[] blockColors -
blockDistance
protected long[] blockDistance -
distances
protected long[] distances -
validColors
protected int[] validColors -
validBlockIds
protected int[] validBlockIds -
validLayerColors
protected int[] validLayerColors -
validLayerBlocks
protected int[][] validLayerBlocks -
validMixBiomeColors
protected int[] validMixBiomeColors -
validMixBiomeIds
protected long[] validMixBiomeIds -
validBiomes
https://github.com/erich666/Mineways/blob/master/Win/biomes.cpp
-
-
Constructor Details
-
TextureUtil
Do not use. UseFawe.getTextureUtil()- Throws:
FileNotFoundException
-
TextureUtil
Do not use. UseFawe.getTextureUtil()- Throws:
FileNotFoundException
-
-
Method Details
-
fromClipboard
- Throws:
FileNotFoundException
-
fromBlocks
- Throws:
FileNotFoundException
-
fromMask
- Throws:
FileNotFoundException
-
hueDistance
protected static int hueDistance(int red1, int green1, int blue1, int red2, int green2, int blue2) -
colorDistance
protected static long colorDistance(int c1, int c2) -
multiplyColor
public static int multiplyColor(int c1, int c2) Combine two colors by multipling- Parameters:
c1- color 1c2- color 2- Returns:
- new color
-
averageColor
public static int averageColor(int c1, int c2) Combine two colors by averaging- Parameters:
c1- color 1c2- color 2- Returns:
- new color
-
averageColor
public static int averageColor(int... colors) Combine multiple colors by multipling- Parameters:
colors- colors- Returns:
- new color
-
combineTransparency
public static int combineTransparency(int top, int bottom) Assumes the top layer is a transparent color and the bottom is opaque -
getTextureUtil
- Specified by:
getTextureUtilin interfaceTextureHolder
-
fork
Create a copy of thisTextureUtilinstance if required for thread safety.- Returns:
- either this
TextureUtilinstance if thread safe or a new copied instance. - Since:
- 2.13.0
-
getNearestBlock
Get the block most closely matching a color based on the block's average color- Parameters:
color- color to match- Returns:
- matching block
-
getNextNearestBlock
Get the block most closely matching a color, without matching the color, based on the block's average color- Parameters:
color- color to match- Returns:
- matching block
-
getNearestLayer
Returns the block combined ids as an array. -
getLighterBlock
Get the next lightest block- Parameters:
block- input block- Returns:
- next lightest block
-
getDarkerBlock
Get the next darkest block- Parameters:
block- input block- Returns:
- next darkest block
-
getLighterBlock
Get the next lightest block- Parameters:
color- input color- Returns:
- next lightest block
-
getDarkerBlock
Get the next darkest block- Parameters:
color- input color- Returns:
- next darkest block
-
getColor
Get the integer representation of a block's RGBA color.- Parameters:
block- input block- Returns:
- integer RGBA color
-
getColor
Get the integer representation of a biomes's RGBA color when applied to grass.- Parameters:
biome- input biome- Returns:
- integer RGBA color
-
getBiome
Get theTextureUtil.BiomeColorentry from a biome's ID- Parameters:
biome- biome id- Returns:
- the
TextureUtil.BiomeColorentry
-
getIsBlockCloserThanBiome
protected boolean getIsBlockCloserThanBiome(char[] blockAndBiomeIdOutput, int color, int biomePriority) -
getBiomeMix
protected int getBiomeMix(int[] biomeIdsOutput, int color) -
getNearestBiome
Get the biome most closely matching a color based on the block's average color- Parameters:
color- color to match- Returns:
- matching block
-
getFolder
-
loadModTextures
- Throws:
IOException
-
calculateLayerArrays
protected void calculateLayerArrays() -
getNearestBlock
-
getNearestBlock
-
hasAlpha
protected boolean hasAlpha(int color) -
getValidBlockIds
public int[] getValidBlockIds()
-