package net.wizardsoflua.testenv.net;

import java.io.IOException;

import com.google.common.base.Throwables;

import io.netty.buffer.ByteBuf;
import net.minecraft.network.PacketBuffer;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;

@RequiresMainThread
public abstract class AbstractMessage implements IMessage {
  protected abstract void read(PacketBuffer buffer) throws IOException;

  protected abstract void write(PacketBuffer buffer) throws IOException;

  protected void writeString(ByteBuf buffer, String string) {
    if (string == null) {
      buffer.writeInt(-1);
    } else {
      buffer.writeInt(string.length());
      buffer.writeBytes(string.getBytes());
    }
  }

  protected String readString(ByteBuf buffer) {
    int len = buffer.readInt();
    if (len == -1) {
      return null;
    } else {
      byte[] bytes = new byte[len];
      buffer.readBytes(bytes);
      return new String(bytes);
    }
  }

  @Override
  public void fromBytes(ByteBuf buffer) {
    try {
      read(new PacketBuffer(buffer));
    } catch (IOException e) {
      throw Throwables.propagate(e);
    }
  }

  @Override
  public void toBytes(ByteBuf buffer) {
    try {
      write(new PacketBuffer(buffer));
    } catch (IOException e) {
      throw Throwables.propagate(e);
    }
  }

}

@@ -64,52 +64,8 @@
 on;%0A
-%0Aimport com.google.common.base.Throwables;%0A%0A
 impo
@@ -1039,36 +1039,36 @@
   throw 
-Throwables.propagate
+new RuntimeException
 (e);%0A   
@@ -1222,28 +1222,28 @@
 row 
-Throwables.propagate
+new RuntimeException
 (e);

Remove use of the deprecated method Throwables.propagate