@SubscribeEvent public void clientPacket( final ClientCustomPacketEvent ev ) { try { if ( clientPacketHandler != null ) { clientPacketHandler.onPacketData( ev.getPacket(), ev.getHandler() ); } } catch ( final ThreadQuickExitException ext ) { ; } }
/** * Invoked when the client receives a packet from the server */ @SubscribeEvent public void onServerPacket(final ClientCustomPacketEvent event) { if (!event.getPacket().channel().equals(Reference.CHANNEL)) return; Minecraft.getMinecraft().addScheduledTask(new Runnable() { @Override public void run() { try {handleServerPacket(event.getPacket());} catch (Exception ex) { ex.printStackTrace(); MoreCommands.INSTANCE.getLogger().warn("Error handling Packet"); } } }); }
@SubscribeEvent public void onPacketData(ClientCustomPacketEvent event) { FMLProxyPacket packet = event.packet; packet.payload().array(); try { ByteBufInputStream input = new ByteBufInputStream(event.packet.payload()); MiscellaneousNonsense.proxy.handleTpsReport(input.readFloat()); input.close(); } catch (IOException e) { e.printStackTrace(); } return; }
@SubscribeEvent public void onPacket(final ClientCustomPacketEvent event) { if (!Core.proxy.isClientThread()) { Core.proxy.addScheduledClientTask(new Runnable() { public void run() { handlePacket(event, false, Core.proxy.getClientPlayer()); } }); } else { handlePacket(event, false, Core.proxy.getClientPlayer()); } }
@SubscribeEvent @SideOnly(Side.CLIENT) public void recievePacket(ClientCustomPacketEvent event) { ByteBufInputStream input = new ByteBufInputStream(event.packet.payload()); try { handleNotify(input, Minecraft.getMinecraft().thePlayer); } catch (IOException e) { e.printStackTrace(); } }