Advertisement
Guest User

Untitled

a guest
Jan 28th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. package de.promolitor.copymultiplayerworld.network;
  2.  
  3. import cpw.mods.fml.common.network.simpleimpl.IMessage;
  4. import io.netty.buffer.ByteBuf;
  5.  
  6. public class DataMessage implements IMessage {
  7.  
  8.     public byte[] data;
  9.  
  10.     public DataMessage() {
  11.  
  12.     }
  13.  
  14.     public DataMessage(byte[] data) {
  15.         this.data = data;
  16.     }
  17.  
  18.     @Override
  19.     public void toBytes(ByteBuf buf) {
  20.         // Writes the int into the buf
  21.         buf.writeBytes(data);
  22.  
  23.     }
  24.  
  25.     @Override
  26.     public void fromBytes(ByteBuf buf) {
  27.         // Reads the int back from the buf. Note that if you have multiple
  28.         // values, you must read in the same order you wrote.
  29.         data = new byte[HOW BIG?]
  30.         buf.readBytes(data);
  31.     }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement