mirror of
https://github.com/GTNewHorizons/ThaumicTinkerer.git
synced 2026-11-28 16:06:07 +00:00
50 lines
1.5 KiB
Java
50 lines
1.5 KiB
Java
/**
|
|
* This class was created by <Vazkii>. It's distributed as
|
|
* part of the ThaumicTinkerer Mod.
|
|
*
|
|
* ThaumicTinkerer is Open Source and distributed under a
|
|
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
|
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
|
*
|
|
* ThaumicTinkerer is a Derivative Work on Thaumcraft 3.
|
|
* Thaumcraft 3 © Azanor 2012
|
|
* (http://www.minecraftforum.net/topic/1585216-)
|
|
*
|
|
* File Created @ [28 Apr 2013, 20:06:45 (GMT)]
|
|
*/
|
|
package vazkii.tinkerer.network;
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.DataInputStream;
|
|
import java.io.DataOutputStream;
|
|
import java.io.IOException;
|
|
|
|
import net.minecraft.network.INetworkManager;
|
|
import net.minecraft.network.packet.Packet250CustomPayload;
|
|
import cpw.mods.fml.common.network.Player;
|
|
|
|
public abstract class ModPacket {
|
|
|
|
public abstract ByteArrayOutputStream asOutputStream() throws IOException;
|
|
|
|
public abstract boolean readPayload(Packet250CustomPayload packet, INetworkManager manager, Player player, String subchannel) throws IOException;
|
|
|
|
public abstract String getSubchannel();
|
|
|
|
public ByteArrayOutputStream emptyStream() throws IOException {
|
|
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
|
DataOutputStream data = new DataOutputStream(stream);
|
|
writeSubchannel(data);
|
|
return stream;
|
|
}
|
|
|
|
public final void skipSubchannel(DataInputStream stream) throws IOException {
|
|
stream.readUTF();
|
|
}
|
|
|
|
public final void writeSubchannel(DataOutputStream stream) throws IOException {
|
|
stream.writeUTF(getSubchannel());
|
|
}
|
|
|
|
}
|