diff --git a/src/main/scala/li/cil/oc/client/PacketHandler.scala b/src/main/scala/li/cil/oc/client/PacketHandler.scala index 44ac676af..32db9210f 100644 --- a/src/main/scala/li/cil/oc/client/PacketHandler.scala +++ b/src/main/scala/li/cil/oc/client/PacketHandler.scala @@ -40,7 +40,7 @@ object PacketHandler extends CommonPacketHandler { } override def dispatch(p: PacketParser) { - if (p.player != null && p.player.getEntityWorld != null) p.packetType match { + p.packetType match { case PacketType.Analyze => onAnalyze(p) case PacketType.ChargerState => onChargerState(p) case PacketType.ColorChange => onColorChange(p) diff --git a/src/main/scala/li/cil/oc/common/EventHandler.scala b/src/main/scala/li/cil/oc/common/EventHandler.scala index 087dcd775..3d5d2222e 100644 --- a/src/main/scala/li/cil/oc/common/EventHandler.scala +++ b/src/main/scala/li/cil/oc/common/EventHandler.scala @@ -134,8 +134,13 @@ object EventHandler { if (ClassTransformer.hadSimpleComponentErrors) { player.addChatMessage(Localization.Chat.WarningSimpleComponent) } - ServerPacketSender.sendPetVisibility(None, Some(player)) - ServerPacketSender.sendLootDisks(player) + // Gaaah, MC 1.8 y u do this to me? Sending the packets here directly can lead to them + // arriving on the client before it has a world and player instance, which causes all + // sorts of trouble. It worked perfectly fine in MC 1.7.10... oSWDEG'PIl;dg'poinEG\a'pi= + EventHandler.schedule(() => { + ServerPacketSender.sendPetVisibility(None, Some(player)) + ServerPacketSender.sendLootDisks(player) + }) // Do update check in local games and for OPs. if (!Mods.VersionChecker.isAvailable && (!MinecraftServer.getServer.isDedicatedServer || MinecraftServer.getServer.getConfigurationManager.canSendCommands(player.getGameProfile))) { Future {