Advertisement
hassansyyid

Untitled

Jul 31st, 2015
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.78 KB | None | 0 0
  1. package com.arisux.avp;
  2.  
  3. import com.arisux.airi.lib.interfaces.IInitializable;
  4. import com.arisux.avp.packets.client.PacketAmmoUpdate;
  5. import com.arisux.avp.packets.client.PacketKillCountUpdate;
  6. import com.arisux.avp.packets.client.PacketPlayerModeUpdate;
  7. import com.arisux.avp.packets.client.PacketRotateTransformer;
  8. import com.arisux.avp.packets.client.PacketSyncEEPC;
  9. import com.arisux.avp.packets.client.PacketSyncEEPPC;
  10. import com.arisux.avp.packets.client.PacketTurretInit;
  11. import com.arisux.avp.packets.server.PacketAddTuretTarget;
  12. import com.arisux.avp.packets.server.PacketAssembleCurrentSchematic;
  13. import com.arisux.avp.packets.server.PacketDamageEntity;
  14. import com.arisux.avp.packets.server.PacketFireAPC;
  15. import com.arisux.avp.packets.server.PacketLaunchGrenade;
  16. import com.arisux.avp.packets.server.PacketOpenWristbracerContainer;
  17. import com.arisux.avp.packets.server.PacketReadFromDataDevice;
  18. import com.arisux.avp.packets.server.PacketReloadFirearm;
  19. import com.arisux.avp.packets.server.PacketRemoveTurretTarget;
  20. import com.arisux.avp.packets.server.PacketShootEntity;
  21. import com.arisux.avp.packets.server.PacketSpawnEntity;
  22. import com.arisux.avp.packets.server.PacketSpawnNuke;
  23. import com.arisux.avp.packets.server.PacketSyncEEPPS;
  24. import com.arisux.avp.packets.server.PacketSyncEEPS;
  25. import com.arisux.avp.packets.server.PacketTurretTargetUpdate;
  26. import com.arisux.avp.packets.server.PacketWriteToDataDevice;
  27.  
  28. import cpw.mods.fml.common.event.FMLInitializationEvent;
  29. import cpw.mods.fml.common.network.simpleimpl.IMessage;
  30. import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
  31. import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
  32. import cpw.mods.fml.relauncher.Side;
  33.  
  34. public class NetworkHandler extends SimpleNetworkWrapper implements IInitializable
  35. {
  36.     public static final NetworkHandler instance = new NetworkHandler();
  37.     private int descriminator = 0;
  38.  
  39.     public NetworkHandler()
  40.     {
  41.         super(AliensVsPredator.ID.toUpperCase());
  42.     }
  43.  
  44.     @Override
  45.     public void initialize(FMLInitializationEvent event)
  46.     {
  47.         this.registerMessage(Side.SERVER, PacketAssembleCurrentSchematic.class);
  48.         this.registerMessage(Side.SERVER, PacketOpenWristbracerContainer.class);
  49.         this.registerMessage(Side.SERVER, PacketReloadFirearm.class);
  50.         this.registerMessage(Side.SERVER, PacketLaunchGrenade.class);
  51.         this.registerMessage(Side.SERVER, PacketFireAPC.class);
  52.         this.registerMessage(Side.SERVER, PacketDamageEntity.class);
  53.         this.registerMessage(Side.SERVER, PacketRemoveTurretTarget.class);
  54.         this.registerMessage(Side.SERVER, PacketShootEntity.class);
  55.         this.registerMessage(Side.SERVER, PacketSpawnEntity.class);
  56.         this.registerMessage(Side.SERVER, PacketSpawnNuke.class);
  57.         this.registerMessage(Side.SERVER, PacketAddTuretTarget.class);
  58.         this.registerMessage(Side.SERVER, PacketReadFromDataDevice.class);
  59.         this.registerMessage(Side.SERVER, PacketTurretTargetUpdate.class);
  60.         this.registerMessage(Side.SERVER, PacketWriteToDataDevice.class);
  61.         this.registerMessage(Side.CLIENT, PacketKillCountUpdate.class);
  62.         this.registerMessage(Side.CLIENT, PacketAmmoUpdate.class);
  63.         this.registerMessage(Side.CLIENT, PacketRotateTransformer.class);
  64.         this.registerMessage(Side.CLIENT, PacketPlayerModeUpdate.class);
  65.         this.registerMessage(Side.CLIENT, PacketTurretInit.class);
  66.         this.registerMessage(Side.CLIENT, PacketSyncEEPC.class);
  67.         this.registerMessage(Side.CLIENT, PacketSyncEEPPC.class);
  68.         this.registerMessage(Side.SERVER, PacketSyncEEPS.class);
  69.         this.registerMessage(Side.SERVER, PacketSyncEEPPS.class);
  70.     }
  71.  
  72.     @SuppressWarnings("unchecked")
  73.     private <REQ extends IMessage, REPLY extends IMessage> void registerMessage(Side side, Class<?> packet)
  74.     {
  75.         this.registerMessage((Class<? extends IMessageHandler<REQ, REPLY>>) packet, (Class <REQ>) packet, descriminator++, side);
  76.     }
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement