Mekanism-tilera-Edition/src/main/java/mekanism/common/network/PacketKey.java

55 lines
935 B
Java
Raw Normal View History

2013-12-05 22:42:00 +01:00
package mekanism.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import mekanism.common.Mekanism;
import net.minecraft.entity.player.EntityPlayer;
2013-12-05 22:42:00 +01:00
public class PacketKey extends MekanismPacket
2013-12-05 22:42:00 +01:00
{
public int key;
public boolean add;
public PacketKey() {}
public PacketKey(int k, boolean a)
2013-12-05 22:42:00 +01:00
{
key = k;
add = a;
2013-12-05 22:42:00 +01:00
}
@Override
public void write(ChannelHandlerContext ctx, ByteBuf dataStream)
{
dataStream.writeInt(key);
dataStream.writeBoolean(add);
}
@Override
public void read(ChannelHandlerContext ctx, EntityPlayer player, ByteBuf dataStream)
2013-12-05 22:42:00 +01:00
{
key = dataStream.readInt();
add = dataStream.readBoolean();
if(add)
{
Mekanism.keyMap.add(player, key);
}
else {
Mekanism.keyMap.remove(player, key);
}
2013-12-05 22:42:00 +01:00
}
@Override
public void handleClientSide(EntityPlayer player)
{
}
@Override
public void handleServerSide(EntityPlayer player)
{
}
2013-12-05 22:42:00 +01:00
}