package com.yolp900.itsjustacharm.common.network;
import com.yolp900.itsjustacharm.ItsJustaCharm;
import com.yolp900.itsjustacharm.reference.LibTexts;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.fml.common.network.ByteBufUtils;
public class MessageChatMessage extends MessageBase<MessageChatMessage> {
private LibTexts.ChatMessages text;
public MessageChatMessage() {
}
public MessageChatMessage(LibTexts.ChatMessages text) {
this.text = text;
}
@Override
public void handleClientSide(MessageChatMessage message, EntityPlayer player) {
ItsJustaCharm.proxy.chatMessage(message.text);
}
@Override
public void handleServerSide(MessageChatMessage message, EntityPlayer player) {
}
@Override
public void fromBytes(ByteBuf buf) {
this.text = LibTexts.ChatMessages.valueOf(ByteBufUtils.readUTF8String(buf));
}
@Override
public void toBytes(ByteBuf buf) {
ByteBufUtils.writeUTF8String(buf, this.text.toString());
}
}