Skip to main content

DifficultyPacket

class

Declaration

[ProtocolSupport(735, 776)]
[Packet("play.toClient.difficulty", PacketPhase.Play, PacketDirection.Clientbound)]
[PacketField("Difficulty", "Difficulty")]
[PacketField("DifficultyLocked", "bool")]
public sealed record DifficultyPacket : IPacket<DifficultyPacket>, IProtocolType<DifficultyPacket>, IPacket
NamespaceMcProtoNet.Protocol.Packets.Play.Clientbound
AssemblyMcProtoNet.Protocol.dll
Sourcesrc/McProtoNet.Protocol/Generated/Packets/Play/Clientbound/DifficultyPacket.cs#L5 ↗

Implements: IPacket<DifficultyPacket>, IProtocolType<DifficultyPacket>, IPacket

Constructors

SignatureDescription
DifficultyPacket(Difficulty Difficulty, bool DifficultyLocked)-

DifficultyPacket(Difficulty, bool)

public DifficultyPacket(Difficulty Difficulty, bool DifficultyLocked)

Parameters: Difficulty (Difficulty), DifficultyLocked (Boolean)

Properties

SignatureDescription
Difficulty Difficulty-
bool DifficultyLocked-
static PacketIdentity IdentityGets the identity of the packet type.

Difficulty

public Difficulty Difficulty { get; init; }

Returns: Difficulty

DifficultyLocked

public bool DifficultyLocked { get; init; }

Returns: Boolean

Identity

public static PacketIdentity Identity { get; }

Gets the identity of the packet type.

Returns: PacketIdentity

Methods

SignatureDescription
static int GetPacketId(int protocolVersion)-
static DifficultyPacket Read(ref MinecraftPrimitiveReader reader, int protocolVersion)Reads a value of type DifficultyPacket from the specified reader.
static bool TryGetPacketId(int protocolVersion, out int id)Attempts to get the wire id of the packet for the specified protocol version.
void Write(MinecraftPrimitiveWriter writer, int protocolVersion)Writes the current value to the specified writer.

GetPacketId(int)

public static int GetPacketId(int protocolVersion)

Parameters: protocolVersion (Int32)

Returns: Int32

Read(ref MinecraftPrimitiveReader, int)

public static DifficultyPacket Read(ref MinecraftPrimitiveReader reader, int protocolVersion)

Reads a value of type DifficultyPacket from the specified reader.

Parameters: reader (MinecraftPrimitiveReader), protocolVersion (Int32)

Returns: DifficultyPacket - The value that was read.

TryGetPacketId(int, out int)

public static bool TryGetPacketId(int protocolVersion, out int id)

Attempts to get the wire id of the packet for the specified protocol version.

Parameters: protocolVersion (Int32), id (Int32)

Returns: Boolean - <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool"&gt;true&lt;/a> if the packet exists on the specified protocol version; otherwise, <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool"&gt;false&lt;/a>.

Write(MinecraftPrimitiveWriter, int)

public void Write(MinecraftPrimitiveWriter writer, int protocolVersion)

Writes the current value to the specified writer.

Parameters: writer (MinecraftPrimitiveWriter), protocolVersion (Int32)