Advertisement
AwesomeSpider8

PurifierMessage *Changed Energy*

Feb 12th, 2017
107
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class PurifierMessage implements IMessage {
  2.  
  3.     // A default constructor is always required
  4.     public PurifierMessage() {
  5.  
  6.     }
  7.  
  8.     public int progress;
  9.     public int currentProgress;
  10.     //public int storedPower;
  11.     public int powerReceived;
  12.  
  13.     public int id;
  14.  
  15.     public PurifierMessage(int progress, int currentProgress, int powerReceived, int containerID) {
  16.         this.progress = progress;
  17.         this.currentProgress = currentProgress;
  18.         //this.storedPower = storedPower;
  19.         this.powerReceived = powerReceived;
  20.         this.id = containerID;
  21.     }
  22.  
  23.     @Override
  24.     public void toBytes(ByteBuf buf) {
  25.         // Writes the int into the buf
  26.         buf.writeInt(progress);
  27.         buf.writeInt(currentProgress);
  28.         //buf.writeInt(storedPower);
  29.         buf.writeInt(powerReceived);
  30.         buf.writeInt(id);
  31.     }
  32.  
  33.     @Override
  34.     public void fromBytes(ByteBuf buf) {
  35.         // Reads the int back from the buf. Note that if you have multiple values, you must read in the same order you wrote.
  36.         progress = buf.readInt();
  37.         currentProgress = buf.readInt();
  38.         //storedPower = buf.readInt();
  39.         powerReceived = buf.readInt();
  40.         id = buf.readInt();
  41.     }
  42. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement