diff --git a/MCGalaxy/Blocks/BlockDefinitions.cs b/MCGalaxy/Blocks/BlockDefinitions.cs index ca15ef44c..d40ac43d6 100644 --- a/MCGalaxy/Blocks/BlockDefinitions.cs +++ b/MCGalaxy/Blocks/BlockDefinitions.cs @@ -264,15 +264,18 @@ namespace MCGalaxy { internal static void SendLevelCustomBlocks(Player pl) { - BlockDefinition[] defs = pl.level.CustomBlockDefs; - bool supportsOrder = pl.HasCpeExt(CpeExt.InventoryOrder); - + BlockDefinition[] defs = pl.level.CustomBlockDefs; for (int i = 1; i < defs.Length; i++) { BlockDefinition def = defs[i]; - if (def == null) continue; - - pl.Send(def.MakeDefinePacket(pl)); - if (def.InventoryOrder >= 0 && supportsOrder) { + if (def != null) pl.Send(def.MakeDefinePacket(pl)); + } + } + + internal static void SendLevelInventoryOrder(Player pl) { + BlockDefinition[] defs = pl.level.CustomBlockDefs; + for (int i = 1; i < defs.Length; i++) { + BlockDefinition def = defs[i]; + if (def != null && def.InventoryOrder >= 0) { pl.Send(Packet.SetInventoryOrder((byte)i, (byte)def.InventoryOrder)); } } diff --git a/MCGalaxy/Commands/CPE/CustomBlockCommand.cs b/MCGalaxy/Commands/CPE/CustomBlockCommand.cs index 74502325e..a851cd323 100644 --- a/MCGalaxy/Commands/CPE/CustomBlockCommand.cs +++ b/MCGalaxy/Commands/CPE/CustomBlockCommand.cs @@ -418,7 +418,7 @@ namespace MCGalaxy.Commands.CPE { SendEditHelp(p, arg); return; } - def.InventoryOrder = order - 1; + def.InventoryOrder = order; BlockDefinition.UpdateOrder(def, global, level); BlockDefinition.Save(global, level); Player.Message(p, "Set inventory order for {0} to {1}", blockName, value); diff --git a/MCGalaxy/Network/Player.Networking.cs b/MCGalaxy/Network/Player.Networking.cs index 56a8ffaa6..4599f6f58 100644 --- a/MCGalaxy/Network/Player.Networking.cs +++ b/MCGalaxy/Network/Player.Networking.cs @@ -200,9 +200,14 @@ namespace MCGalaxy { Send(Packet.LevelInitalise()); if (hasBlockDefs) { - if (oldLevel != null && oldLevel != level) + if (oldLevel != null && oldLevel != level) { RemoveOldLevelCustomBlocks(oldLevel); + } BlockDefinition.SendLevelCustomBlocks(this); + + if (HasCpeExt(CpeExt.InventoryOrder)) { + BlockDefinition.SendLevelInventoryOrder(this); + } } using (LevelChunkStream s = new LevelChunkStream(this))