diff options
author | querns <33518699+querns@users.noreply.github.com> | 2024-09-19 08:53:17 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-19 15:53:17 +0200 |
commit | 7ba0fc903e5d14928d2b894b00a7b7dfc65eee18 (patch) | |
tree | ebb230105b63eee5cf116cf48d5827f7542a5c8b /src/main/java/gregtech/api/enums/Dyes.java | |
parent | c24b78060631ea1868c06aeb3b45fd81218d379e (diff) | |
download | GT5-Unofficial-7ba0fc903e5d14928d2b894b00a7b7dfc65eee18.tar.gz GT5-Unofficial-7ba0fc903e5d14928d2b894b00a7b7dfc65eee18.tar.bz2 GT5-Unofficial-7ba0fc903e5d14928d2b894b00a7b7dfc65eee18.zip |
Infinite Spraycan Additions (#3226)
Co-authored-by: Caedis <Caedis@users.noreply.github.com>
Diffstat (limited to 'src/main/java/gregtech/api/enums/Dyes.java')
-rw-r--r-- | src/main/java/gregtech/api/enums/Dyes.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/enums/Dyes.java b/src/main/java/gregtech/api/enums/Dyes.java index 1dedcb6af0..72113b554a 100644 --- a/src/main/java/gregtech/api/enums/Dyes.java +++ b/src/main/java/gregtech/api/enums/Dyes.java @@ -6,6 +6,8 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.Contract; + import gregtech.api.interfaces.IColorModulationContainer; import gregtech.api.objects.GTArrayList; import gregtech.api.util.GTUtility; @@ -123,4 +125,19 @@ public enum Dyes implements IColorModulationContainer { public static Dyes getDyeFromIndex(short index) { return index != -1 ? Dyes.get(index) : Dyes.MACHINE_METAL; } + + /** + * Transforms a dye index between the GT index for this color and the vanilla index for this color. + * + * @param color an integer between 0 and 15 + * @return the transformed color + */ + @Contract(pure = true) + public static int transformDyeIndex(final int color) { + if (color < 0 || color > 15) { + throw new IllegalArgumentException("Color passed to transformColor must be between 0 and 15"); + } + + return (~(byte) color) & 0xF; + } } |