Skip to content

janTatesa/ratatui-minecraft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A ratatui backend that uses valence-screens to render the terminal image

Installation

cargo add --git https://github.com/janTatesa/ratatui-minecraft

Usage

The library provides a simple run method which takes an initial state, a function that refreshes the ui and a function that handles events. After implementing the application simply just cargo run and type localhost to the IP adress field in minecraft server creation. You will be greeted wwith more instructions

Example

use ratatui::{
    Frame,
    layout::Rect,
    style::{Style, Stylize},
    text::Span,
};
use ratatui_minecraft::eventless;

fn main() {
    ratatui_minecraft::run((), |_, t| _ = t.draw(render), eventless)
}

fn render(frame: &mut Frame<'_>) {
    [
        ("green", Style::new().green()),
        ("bold", Style::new().bold()),
        ("italic", Style::new().italic()),
        ("underlined", Style::new().underlined()),
    ]
    .into_iter()
    .enumerate()
    .for_each(|(index, (name, style))| {
        frame.render_widget(
            Span::raw(name).style(style),
            Rect {
                y: frame.area().y + index as u16,
                ..frame.area()
            },
        )
    });
}

WARNING

The server is set to offline mode (to make debugging easier) meaning that there is no account verification, and everyone who has access to the port 25565 on your computer can connect to the server and interact with your application. THIS IS AN EXPERIMENTAL PROJECT, DON'T IMPLEMENT ANY SYSTEM APPLICATIONS WITH IT

About

Valence screens port to ratatui

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published