Add ToggleBlockList CPE

This commit is contained in:
Derek 2025-05-11 13:11:40 +10:00
parent 834adbaf2d
commit a62118f9da
5 changed files with 23 additions and 3 deletions

View File

@ -95,6 +95,7 @@ namespace MCGalaxy
public const string LightingMode = "LightingMode"; public const string LightingMode = "LightingMode";
public const string CinematicGui = "CinematicGui"; public const string CinematicGui = "CinematicGui";
public const string NotifyAction = "NotifyAction"; public const string NotifyAction = "NotifyAction";
public const string ToggleBlockList = "ToggleBlockList";
} }
public sealed class CpeExtension public sealed class CpeExtension

View File

@ -585,6 +585,14 @@ namespace MCGalaxy.Network
(ushort)(barSize * ushort.MaxValue))); (ushort)(barSize * ushort.MaxValue)));
return true; return true;
} }
public override bool SendToggleBlockList(bool toggle)
{
if (!Supports(CpeExt.ToggleBlockList)) return false;
Send(Packet.ToggleBlockList(toggle));
return true;
}
#endregion #endregion

View File

@ -114,6 +114,8 @@ namespace MCGalaxy.Network
public abstract bool SendRemoveSelection(byte id); public abstract bool SendRemoveSelection(byte id);
/// <summary> Sends a cinematic gui definition to the client </summary> /// <summary> Sends a cinematic gui definition to the client </summary>
public abstract bool SendCinematicGui(CinematicGui gui); public abstract bool SendCinematicGui(CinematicGui gui);
/// <summary> Sends a toggle block list packet to the client </summary>
public abstract bool SendToggleBlockList(bool toggle);
/// <summary> Sends a level to the client </summary> /// <summary> Sends a level to the client </summary>
public abstract void SendLevel(Level prev, Level level); public abstract void SendLevel(Level prev, Level level);

View File

@ -82,5 +82,6 @@ namespace MCGalaxy.Network {
public const byte CpeCinematicGui = 56; public const byte CpeCinematicGui = 56;
public const byte CpeNotifyAction = 57; public const byte CpeNotifyAction = 57;
public const byte CpeNotifyPositionAction = 58; public const byte CpeNotifyPositionAction = 58;
public const byte CpeToggleBlockList = 59;
} }
} }

View File

@ -707,8 +707,16 @@ namespace MCGalaxy.Network
NetUtils.WriteU16(barSize, buffer, 8); NetUtils.WriteU16(barSize, buffer, 8);
return buffer; 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 #region Block definitions