Guest User

Untitled

a guest
May 3rd, 2015
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. package net.nukacraft.src;
  2.  
  3. import io.netty.buffer.ByteBuf;
  4. import net.minecraft.entity.player.EntityPlayerMP;
  5. import cpw.mods.fml.common.network.simpleimpl.IMessage;
  6. import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
  7. import cpw.mods.fml.common.network.simpleimpl.MessageContext;
  8.  
  9.  
  10. public class MessageActionWeapons2 implements IMessage {
  11.  
  12. public int button;
  13.  
  14. public MessageActionWeapons2() {}
  15.  
  16. public MessageActionWeapons2(int button) {
  17. this.button = button;
  18. }
  19.  
  20. @Override
  21. public void toBytes(ByteBuf buf) {
  22. buf.writeInt(button);
  23. }
  24.  
  25. @Override
  26. public void fromBytes(ByteBuf buf) {
  27. button = buf.readInt();
  28. }
  29. //----------------------------------------------------------------------------------
  30. public static class Handler implements IMessageHandler<MessageActionWeapons2, IMessage> {
  31.  
  32. @Override
  33. public IMessage onMessage(MessageActionWeapons2 packet, MessageContext message) {
  34. int button = packet.button;
  35. EntityPlayerMP player = message.getServerHandler().playerEntity;
  36.  
  37. switch(button) {
  38. //case 1:ActionWeapons.onFire(player);break;
  39. case 3:ActionWeapons2.onButton_left(player);break;
  40. }
  41.  
  42. return null;
  43. }
  44.  
  45. }
  46. //----------------------------------------------------------------------------------
  47. }
Advertisement
Add Comment
Please, Sign In to add comment