From 8832c1dd45efb59604d210e0083710512695f8ac Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sun, 19 Feb 2017 20:46:10 +1100 Subject: [PATCH] commands such as /b should show /lb name if it overrides a core block --- MCGalaxy/Levels/Level.Blocks.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/MCGalaxy/Levels/Level.Blocks.cs b/MCGalaxy/Levels/Level.Blocks.cs index 3f0f23494..a2d533a86 100644 --- a/MCGalaxy/Levels/Level.Blocks.cs +++ b/MCGalaxy/Levels/Level.Blocks.cs @@ -436,16 +436,15 @@ namespace MCGalaxy { } public string BlockName(byte block, byte extBlock) { - if (block != Block.custom_block) + if (block == Block.custom_block) { + BlockDefinition def = CustomBlockDefs[extBlock]; + return def == null ? extBlock.ToString() : def.Name.Replace(" ", ""); + } else if (block >= Block.CpeCount) { return Block.Name(block); - - BlockDefinition[] defs = CustomBlockDefs; - for (int i = 1; i < Block.Invalid; i++) { - BlockDefinition def = defs[i]; - if (def == null) continue; - if (def.BlockID == extBlock) return def.Name.Replace(" ", ""); + } else { + BlockDefinition def = CustomBlockDefs[block]; + return def == null ? Block.Name(block) : def.Name.Replace(" ", ""); } - return extBlock.ToString(); } } }