Class PacketContextImpl

java.lang.Object
net.fabricmc.fabric.impl.networking.context.PacketContextImpl
All Implemented Interfaces:
PacketContext

public final class PacketContextImpl extends Object implements PacketContext
  • Field Details

    • VALUE

      public static final ScopedValue<PacketContext> VALUE
    • SERVER_INSTANCE

      public static final PacketContext.Key<net.minecraft.server.MinecraftServer> SERVER_INSTANCE
    • REGISTRY_ACCESS

      public static final PacketContext.Key<net.minecraft.core.RegistryAccess> REGISTRY_ACCESS
    • GAME_PROFILE

      public static final PacketContext.Key<com.mojang.authlib.GameProfile> GAME_PROFILE
    • CONNECTION

      public static final PacketContext.Key<@NonNull net.minecraft.network.Connection> CONNECTION
  • Constructor Details

    • PacketContextImpl

      public PacketContextImpl(net.minecraft.network.Connection connection)
  • Method Details

    • get

      public <T> @Nullable T get(PacketContext.ReadKey<T> key)
      Description copied from interface: PacketContext
      Returns currently stored value.
      Specified by:
      get in interface PacketContext
      Parameters:
      key - unique key under which value is stored
      Returns:
      stored value or null if not set.
    • set

      public <T> void set(PacketContext.Key<T> key, T value)
      Description copied from interface: PacketContext
      Stores the value.
      Specified by:
      set in interface PacketContext
      Parameters:
      key - unique key under which value is stored
      value - value to store, if null it will remove it instead