diff --git a/GUI/PropertyWindow/PropertyWindow.Blocks.cs b/GUI/PropertyWindow/PropertyWindow.Blocks.cs index 725f7a2ff..9ccd1a545 100644 --- a/GUI/PropertyWindow/PropertyWindow.Blocks.cs +++ b/GUI/PropertyWindow/PropertyWindow.Blocks.cs @@ -46,7 +46,7 @@ namespace MCGalaxy.Gui { blockPropsChanged[b].ChangedScope = 0; BlockID block = (BlockID)b; - if (!BlockExists(block)) continue; + if (!Block.ExistsGlobal(block)) continue; string name = Block.GetName(null, block); blk_list.Items.Add(name); @@ -57,12 +57,6 @@ namespace MCGalaxy.Gui { blk_list.SelectedIndex = 0; } } - - bool BlockExists(BlockID b) { - if (b < Block.Count) return !Block.Undefined(b); - BlockRaw raw = (BlockRaw)b; - return BlockDefinition.GlobalDefs[raw] != null; - } void SaveBlocks() { if (!BlocksChanged()) { LoadBlocks(); return; } diff --git a/MCGalaxy/Blocks/Block.Convert.cs b/MCGalaxy/Blocks/Block.Convert.cs index a99933626..8dde23aff 100644 --- a/MCGalaxy/Blocks/Block.Convert.cs +++ b/MCGalaxy/Blocks/Block.Convert.cs @@ -25,6 +25,14 @@ namespace MCGalaxy { internal static string[] coreNames = new string[Block.Count]; public static bool Undefined(BlockID block) { return IsPhysicsType(block) && coreNames[block].CaselessEq("unknown"); } + public static bool ExistsGlobal(BlockID b) { + if (b < Block.Count) return !Undefined(b); + if (b >= Block.Extended && b < Block.Extended + Block.CpeCount) return false; + + BlockRaw raw = (BlockRaw)b; + return BlockDefinition.GlobalDefs[raw] != null; + } + public static byte Byte(string type) { byte block; if (byte.TryParse(type, out block) && block < CpeCount) diff --git a/MCGalaxy/Blocks/Physics/ExtLiquidPhysics.cs b/MCGalaxy/Blocks/Physics/ExtLiquidPhysics.cs index 74d40a7de..a4bf56cb8 100644 --- a/MCGalaxy/Blocks/Physics/ExtLiquidPhysics.cs +++ b/MCGalaxy/Blocks/Physics/ExtLiquidPhysics.cs @@ -123,7 +123,7 @@ namespace MCGalaxy.Blocks.Physics { BlockID block = C.Block; LiquidPhysics.PhysWater(lvl, (ushort)(x + 1), y, z, block); LiquidPhysics.PhysWater(lvl, (ushort)(x - 1), y, z, block); - LiquidPhysics.PhysWater(lvl, x, y, (ushort)(z + 1),block); + LiquidPhysics.PhysWater(lvl, x, y, (ushort)(z + 1), block); LiquidPhysics.PhysWater(lvl, x, y, (ushort)(z - 1), block); if (!C.Data.HasWait) C.Data.Data = PhysicsArgs.RemoveFromChecks; break; diff --git a/MCGalaxy/Commands/Information/CmdBlocks.cs b/MCGalaxy/Commands/Information/CmdBlocks.cs index f7f04dbf5..eb240bd7b 100644 --- a/MCGalaxy/Commands/Information/CmdBlocks.cs +++ b/MCGalaxy/Commands/Information/CmdBlocks.cs @@ -68,7 +68,7 @@ namespace MCGalaxy.Commands.Info { static List ComplexBlocks() { List blocks = new List(Block.Count); for (BlockID block = Block.CpeCount; block < Block.Count; block++) { - if (!Block.Undefined(block)) blocks.Add(block); + if (Block.ExistsGlobal(block)) blocks.Add(block); } return blocks; } @@ -77,7 +77,7 @@ namespace MCGalaxy.Commands.Info { List blocks = new List(Block.Count); foreach (BlockPerms perms in BlockPerms.List) { if (!BlockPerms.UsableBy(perm, perms.ID)) continue; - if (Block.Undefined(perms.ID)) continue; + if (!Block.ExistsGlobal(perms.ID)) continue; blocks.Add(perms.ID); } return blocks;