diff --git a/MCGalaxy/Network/CPESupport.cs b/MCGalaxy/Network/CPESupport.cs index 6ee1f6c91..0c3aac885 100644 --- a/MCGalaxy/Network/CPESupport.cs +++ b/MCGalaxy/Network/CPESupport.cs @@ -95,6 +95,7 @@ namespace MCGalaxy public const string LightingMode = "LightingMode"; public const string CinematicGui = "CinematicGui"; public const string NotifyAction = "NotifyAction"; + public const string ToggleBlockList = "ToggleBlockList"; } public sealed class CpeExtension diff --git a/MCGalaxy/Network/ClassicProtocol.cs b/MCGalaxy/Network/ClassicProtocol.cs index 47ec7ed07..61803f167 100644 --- a/MCGalaxy/Network/ClassicProtocol.cs +++ b/MCGalaxy/Network/ClassicProtocol.cs @@ -585,10 +585,18 @@ namespace MCGalaxy.Network (ushort)(barSize * ushort.MaxValue))); return true; } -#endregion + + public override bool SendToggleBlockList(bool toggle) + { + if (!Supports(CpeExt.ToggleBlockList)) return false; + + Send(Packet.ToggleBlockList(toggle)); + return true; + } + #endregion -#region Higher level sending + #region Higher level sending public override void SendMotd(string motd) { motd = CleanupColors(motd); Send(Packet.Motd(player, motd)); diff --git a/MCGalaxy/Network/IGameSession.cs b/MCGalaxy/Network/IGameSession.cs index e704ffc65..46fbade90 100644 --- a/MCGalaxy/Network/IGameSession.cs +++ b/MCGalaxy/Network/IGameSession.cs @@ -114,6 +114,8 @@ namespace MCGalaxy.Network public abstract bool SendRemoveSelection(byte id); /// Sends a cinematic gui definition to the client public abstract bool SendCinematicGui(CinematicGui gui); + /// Sends a toggle block list packet to the client + public abstract bool SendToggleBlockList(bool toggle); /// Sends a level to the client public abstract void SendLevel(Level prev, Level level); diff --git a/MCGalaxy/Network/Packets/Opcode.cs b/MCGalaxy/Network/Packets/Opcode.cs index b08bed354..aa7bc5dfa 100644 --- a/MCGalaxy/Network/Packets/Opcode.cs +++ b/MCGalaxy/Network/Packets/Opcode.cs @@ -82,5 +82,6 @@ namespace MCGalaxy.Network { public const byte CpeCinematicGui = 56; public const byte CpeNotifyAction = 57; public const byte CpeNotifyPositionAction = 58; + public const byte CpeToggleBlockList = 59; } } diff --git a/MCGalaxy/Network/Packets/Packet.cs b/MCGalaxy/Network/Packets/Packet.cs index 19f3c87a5..1a4569cf9 100644 --- a/MCGalaxy/Network/Packets/Packet.cs +++ b/MCGalaxy/Network/Packets/Packet.cs @@ -707,8 +707,16 @@ namespace MCGalaxy.Network NetUtils.WriteU16(barSize, buffer, 8); return buffer; } - #endregion + public static byte[] ToggleBlockList(bool toggle) + { + byte[] buffer = new byte[2]; + buffer[0] = Opcode.CpeToggleBlockList; + buffer[1] = (byte)(toggle ? 1 : 0); + return buffer; + } + + #endregion #region Block definitions