Class ServerboundChangeDifficultyPacket

java.lang.Object
org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundChangeDifficultyPacket
All Implemented Interfaces:
Packet, MinecraftPacket

public class ServerboundChangeDifficultyPacket extends Object implements MinecraftPacket
  • Constructor Details

    • ServerboundChangeDifficultyPacket

      public ServerboundChangeDifficultyPacket(io.netty.buffer.ByteBuf in, MinecraftCodecHelper helper)
    • ServerboundChangeDifficultyPacket

      public ServerboundChangeDifficultyPacket(@NonNull @NonNull Difficulty difficulty)
  • Method Details

    • serialize

      public void serialize(io.netty.buffer.ByteBuf out, MinecraftCodecHelper helper)
      Specified by:
      serialize in interface MinecraftPacket
    • shouldRunOnGameThread

      public boolean shouldRunOnGameThread()
      Description copied from interface: Packet
      Gets whether the packet should run on an async game thread rather than blocking the network (Netty) thread. Packets that qualify for this are usually packets with an ensureRunningOnSameThread call at the top of their packet listener method in the Minecraft code. Packets which need extra attention because they aren't "fully" handled async are marked using // GAME THREAD DETAIL comments in the MCProtocolLib code.
      Specified by:
      shouldRunOnGameThread in interface Packet
      Returns:
      Whether the packet be handled async from the Netty thread.
    • getDifficulty

      @NonNull public @NonNull Difficulty getDifficulty()
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(@Nullable Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public @NonNull String toString()
      Overrides:
      toString in class Object
    • withDifficulty

      public @NonNull ServerboundChangeDifficultyPacket withDifficulty(@NonNull @NonNull Difficulty difficulty)
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).