Interface ClientContext

All Superinterfaces:
ListenerContext
All Known Subinterfaces:
ClientLoginContext, ClientPlayContext

@Environment(CLIENT)
public interface ClientContext
extends ListenerContext
Represents a context for packet reception on the logical client.

Compared to the basic listener context, the client context offers access to the active MinecraftClient.

  • Method Summary

    Modifier and Type Method Description
    net.minecraft.client.MinecraftClient getEngine()
    Returns the game engine associated with the packet listener.

    Methods inherited from interface io.github.fablabsmc.fablabs.api.networking.v1.ListenerContext

    getListener
  • Method Details

    • getEngine

      net.minecraft.client.MinecraftClient getEngine()
      Returns the game engine associated with the packet listener.

      The game engine exposes access to synchronization of execution to main thread, such as ThreadExecutor.submit(Runnable), allowing you to apply changes to the game without danger of concurrent modification.

      In a client context, the game engine is always a Minecraft Client.

      Specified by:
      getEngine in interface ListenerContext
      Returns:
      the Minecraft Client