|
|
@@ -7,7 +7,10 @@ namespace GamecraftModdingAPI.Blocks |
|
|
|
{ |
|
|
|
public BlockColors Color; |
|
|
|
public byte Darkness; |
|
|
|
public byte Index; |
|
|
|
|
|
|
|
public byte Index => Color == BlockColors.Default |
|
|
|
? byte.MaxValue |
|
|
|
: (byte) (Darkness * 10 + Color); |
|
|
|
|
|
|
|
public BlockColor(byte index) |
|
|
|
{ |
|
|
@@ -23,8 +26,6 @@ namespace GamecraftModdingAPI.Blocks |
|
|
|
Color = (BlockColors) (index % 10); |
|
|
|
Darkness = (byte) (index / 10); |
|
|
|
} |
|
|
|
|
|
|
|
Index = index; |
|
|
|
} |
|
|
|
|
|
|
|
public BlockColor(BlockColors color, byte darkness) |
|
|
@@ -33,8 +34,6 @@ namespace GamecraftModdingAPI.Blocks |
|
|
|
throw new ArgumentOutOfRangeException(nameof(darkness), "Darkness must be 0-9 where 0 is default."); |
|
|
|
Color = color; |
|
|
|
Darkness = darkness; |
|
|
|
if (color == BlockColors.Default) Index = byte.MaxValue; |
|
|
|
else Index = (byte) (darkness * 10 + color); |
|
|
|
} |
|
|
|
|
|
|
|
public float4 RGBA => Block.BlockEngine.ConvertBlockColor(Index); |
|
|
|