Skip to content

Instantly share code, notes, and snippets.

@TheGreyGhost
Created May 31, 2015 10:39
Show Gist options
  • Save TheGreyGhost/f8964ede43732fd1016e to your computer and use it in GitHub Desktop.
Save TheGreyGhost/f8964ede43732fd1016e to your computer and use it in GitHub Desktop.
Workaround for Race condition inSimpleNetworkWrapper
This code works properly (separate copy of each msg)
int dimension = sendingPlayer.dimension;
MinecraftServer minecraftServer = sendingPlayer.mcServer;
for (EntityPlayerMP player : (List<EntityPlayerMP>)minecraftServer.getConfigurationManager().playerEntityList) {
MessageToClient msg = new MessageToClient(nextID); // generate a fresh message for every player
if (dimension == player.dimension) {
simpleNetworkWrapper.sendTo(msg, player);
}
}
@codahq
Copy link

codahq commented Jun 5, 2015

Hmm... If this workaround works for sendToDimension it doesn't appear to be working for SimpleNetworkWrapper.sendTo. I'm using this snippet and I'm still encountering the IOOBE.

https://gist.github.com/codahq/bf21640107959ad73bf4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment