use of net.glowstone.net.message.play.player.InteractEntityMessage in project Glowstone by GlowstoneMC.
the class InteractEntityCodec method decode.
@Override
public InteractEntityMessage decode(ByteBuf buf) throws IOException {
int id = ByteBufUtils.readVarInt(buf);
int action = ByteBufUtils.readVarInt(buf);
if (action == Action.INTERACT_AT.ordinal()) {
float targetX = buf.readFloat();
float targetY = buf.readFloat();
float targetZ = buf.readFloat();
int hand = ByteBufUtils.readVarInt(buf);
return new InteractEntityMessage(id, action, targetX, targetY, targetZ, hand);
} else if (action == Action.INTERACT.ordinal()) {
int hand = ByteBufUtils.readVarInt(buf);
return new InteractEntityMessage(id, action, hand);
}
return new InteractEntityMessage(id, action);
}
Aggregations