Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PurifierMessage implements IMessage {
- // A default constructor is always required
- public PurifierMessage() {
- }
- public int progress;
- public int currentProgress;
- //public int storedPower;
- public int powerReceived;
- public int id;
- public PurifierMessage(int progress, int currentProgress, int powerReceived, int containerID) {
- this.progress = progress;
- this.currentProgress = currentProgress;
- //this.storedPower = storedPower;
- this.powerReceived = powerReceived;
- this.id = containerID;
- }
- @Override
- public void toBytes(ByteBuf buf) {
- // Writes the int into the buf
- buf.writeInt(progress);
- buf.writeInt(currentProgress);
- //buf.writeInt(storedPower);
- buf.writeInt(powerReceived);
- buf.writeInt(id);
- }
- @Override
- public void fromBytes(ByteBuf buf) {
- // Reads the int back from the buf. Note that if you have multiple values, you must read in the same order you wrote.
- progress = buf.readInt();
- currentProgress = buf.readInt();
- //storedPower = buf.readInt();
- powerReceived = buf.readInt();
- id = buf.readInt();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement