-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from BlazingTwist/1.19.4
1.3.0 - support custom text colors
- Loading branch information
Showing
6 changed files
with
88 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/java/blazingtwist/itemcounts/util/ColorHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package blazingtwist.itemcounts.util; | ||
|
||
import net.minecraft.util.math.MathHelper; | ||
|
||
public class ColorHelper { | ||
|
||
public static int lerpColor(float delta, int fromColor, int toColor) { | ||
int red = MathHelper.lerp(delta, getRed(fromColor), getRed(toColor)); | ||
int green = MathHelper.lerp(delta, getGreen(fromColor), getGreen(toColor)); | ||
int blue = MathHelper.lerp(delta, getBlue(fromColor), getBlue(toColor)); | ||
return setRGB(red, green, blue); | ||
} | ||
|
||
public static int getRed(int color) { | ||
return (color & 0xff0000) >> 16; | ||
} | ||
|
||
public static int getGreen(int color) { | ||
return (color & 0xff00) >> 8; | ||
} | ||
|
||
public static int getBlue(int color) { | ||
return (color & 0xff); | ||
} | ||
|
||
public static int setRGB(int red, int green, int blue) { | ||
return ((red & 0xff) << 16) | ((green & 0xff) << 8) | (blue & 0xff); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.