Package net.glowstone.net.codec.play.entity

Source Code of net.glowstone.net.codec.play.entity.EntityHeadRotationCodec

package net.glowstone.net.codec.play.entity;

import com.flowpowered.networking.Codec;
import com.flowpowered.networking.util.ByteBufUtils;
import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.DecoderException;
import net.glowstone.net.message.play.entity.EntityHeadRotationMessage;

import java.io.IOException;

public final class EntityHeadRotationCodec implements Codec<EntityHeadRotationMessage> {
    @Override
    public EntityHeadRotationMessage decode(ByteBuf buf) throws IOException {
        throw new DecoderException("Cannot decode EntityHeadRotationMessage");
    }

    @Override
    public ByteBuf encode(ByteBuf buf, EntityHeadRotationMessage message) throws IOException {
        ByteBufUtils.writeVarInt(buf, message.getId());
        buf.writeByte(message.getRotation());
        return buf;
    }
}
TOP

Related Classes of net.glowstone.net.codec.play.entity.EntityHeadRotationCodec

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.