Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SimpleImpl out of date #30

Closed
elifoster opened this issue Nov 30, 2023 · 1 comment
Closed

SimpleImpl out of date #30

elifoster opened this issue Nov 30, 2023 · 1 comment

Comments

@elifoster
Copy link

Packet handler is no longer passed a Supplier<NetworkEvent.Context> it is passed the NetworkEvent.Context directly.

public static void handle(MyMessage msg, Supplier<NetworkEvent.Context> ctx) {
  ctx.get().enqueueWork(() -> {
    // Work that needs to be thread-safe (most work)
    ServerPlayer sender = ctx.get().getSender(); // the client that sent this packet
    // Do stuff
  });
  ctx.get().setPacketHandled(true);
}

becomes

public static void handle(MyMessage msg, NetworkEvent.Context ctx) {
  ctx.enqueueWork(() -> {
    // Work that needs to be thread-safe (most work)
    ServerPlayer sender = ctx.getSender(); // the client that sent this packet
    // Do stuff
  });
  ctx.setPacketHandled(true);
}

Unsure if anything else there needs updating.

@ChampionAsh5357
Copy link
Contributor

Closed by rewrite via #42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants