diff --git a/GamecraftModdingAPI/Blocks/BlockColor.cs b/GamecraftModdingAPI/Blocks/BlockColor.cs index 46a5dc4..bf22090 100644 --- a/GamecraftModdingAPI/Blocks/BlockColor.cs +++ b/GamecraftModdingAPI/Blocks/BlockColor.cs @@ -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); diff --git a/GamecraftModdingAPI/Blocks/TextBlock.cs b/GamecraftModdingAPI/Blocks/TextBlock.cs index ea5e089..895494d 100644 --- a/GamecraftModdingAPI/Blocks/TextBlock.cs +++ b/GamecraftModdingAPI/Blocks/TextBlock.cs @@ -31,9 +31,9 @@ namespace GamecraftModdingAPI.Blocks set { + if (value == null) value = ""; BlockEngine.SetBlockInfo(this, (ref TextBlockDataStruct tbds, string val) => { - if (val == null) val = ""; tbds.textCurrent.Set(val); tbds.textStored.Set(val); }, value); @@ -51,6 +51,7 @@ namespace GamecraftModdingAPI.Blocks set { + if (value == null) value = ""; BlockEngine.SetBlockInfo(this, (ref TextBlockDataStruct tbds, string val) => tbds.textBlockID.Set(val), value); BlockEngine.SetBlockInfo(this,