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

64 lines
1.3 KiB
Java
Raw Normal View History

2013-10-13 18:31:26 +02:00
package mekanism.common.network;
import java.io.DataOutputStream;
import mekanism.common.item.ItemWalkieTalkie;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import com.google.common.io.ByteArrayDataInput;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
2013-10-13 18:31:26 +02:00
public class PacketWalkieTalkieState extends MekanismPacket
2013-10-13 18:31:26 +02:00
{
public int channel;
public PacketWalkieTalkieState(Object... data)
2013-10-13 18:31:26 +02:00
{
channel = (Integer)data[0];
}
public void read(ByteArrayDataInput dataStream, EntityPlayer player, World world) throws Exception
2013-10-13 18:31:26 +02:00
{
int chan = dataStream.readInt();
2013-10-13 18:31:26 +02:00
ItemStack itemstack = player.getCurrentEquippedItem();
2013-10-13 18:31:26 +02:00
if(itemstack != null && itemstack.getItem() instanceof ItemWalkieTalkie)
{
((ItemWalkieTalkie)itemstack.getItem()).setChannel(itemstack, chan);
}
}
public void write(DataOutputStream dataStream) throws Exception
{
dataStream.writeInt(channel);
}
@Override
public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer)
{
}
@Override
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer)
{
}
@Override
public void handleClientSide(EntityPlayer player)
{
}
@Override
public void handleServerSide(EntityPlayer player)
{
}
2013-10-13 18:31:26 +02:00
}