Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.impuuu.havenrp.packets;
- import cpw.mods.fml.common.network.ByteBufUtils;
- import fr.impuuu.havenrp.message.AfficheMessage;
- import fr.impuuu.havenrp.message.MessageOverlay;
- import io.netty.buffer.ByteBuf;
- import io.netty.channel.ChannelHandlerContext;
- import net.minecraft.entity.player.EntityPlayer;
- public class PacketMessage
- extends AbstractPacketHelper
- {
- String message;
- String subMessage;
- int time;
- public void addInformations(String title, String subTitle, int time)
- {
- this.message = title;
- this.subMessage = subTitle;
- this.time = time;
- }
- public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer)
- {
- ByteBufUtils.writeUTF8String(buffer, this.message);
- ByteBufUtils.writeUTF8String(buffer, this.subMessage);
- buffer.writeInt(this.time);
- }
- public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer)
- {
- this.message = ByteBufUtils.readUTF8String(buffer);
- this.subMessage = ByteBufUtils.readUTF8String(buffer);
- this.time = buffer.readInt();
- }
- public void handleClientSide(EntityPlayer player)
- {
- AfficheMessage message = new AfficheMessage(this.message, this.subMessage, this.time);
- MessageOverlay.addMessageToQueue(message);
- }
- public void handleServerSide(EntityPlayer player) {}
- }
Add Comment
Please, Sign In to add comment