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

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

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.SpawnLightningStrikeMessage;

import java.io.IOException;

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

    @Override
    public ByteBuf encode(ByteBuf buf, SpawnLightningStrikeMessage message) throws IOException {
        ByteBufUtils.writeVarInt(buf, message.getId());
        buf.writeByte(message.getMode());
        buf.writeInt(message.getX());
        buf.writeInt(message.getY());
        buf.writeInt(message.getZ());
        return buf;
    }
}
TOP

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

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.