SHARE
TWEET

Untitled

a guest Sep 25th, 2018 24 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package de.krokoyt.gswords.Skills;
  2.  
  3. import cpw.mods.fml.common.network.simpleimpl.IMessage;
  4. import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
  5. import cpw.mods.fml.common.network.simpleimpl.MessageContext;
  6. import de.krokoyt.gswords.events.Events;
  7. import io.netty.buffer.ByteBuf;
  8.  
  9. public class HealthMessage
  10.   implements IMessage
  11. {
  12.   private static int value;
  13.   private static int percent;
  14.  
  15.   public HealthMessage() {}
  16.  
  17.   public HealthMessage(int level, int per)
  18.   {
  19.     this.value = level;
  20.     this.percent = per;
  21.   }
  22.  
  23.   public void fromBytes(ByteBuf buf)
  24.   {
  25.     this.value = buf.readInt();
  26.     this.percent = buf.readInt();
  27.   }
  28.  
  29.   public void toBytes(ByteBuf buf)
  30.   {
  31.     buf.writeInt(this.value);
  32.     buf.writeInt(this.percent);
  33.   }
  34.  
  35.   public static class Handler
  36.     implements IMessageHandler<HealthMessage, IMessage>
  37.   {
  38.     public IMessage onMessage(HealthMessage msg, MessageContext ctx)
  39.     {
  40.        Events.valueHea = msg.value;
  41.        Events.percentHea = msg.percent;
  42.       return null;
  43.     }
  44.   }
  45. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top