GithubHelp home page GithubHelp logo

neocky / text2mcbook Goto Github PK

View Code? Open in Web Editor NEW
13.0 2.0 4.0 37 KB

๐Ÿ“š Convert any textfile to a formatted text for minecraft books

License: MIT License

Python 100.00%
minecraft-books textfile python minecraft spigot paper bukkit denizen

text2mcbook's Introduction

Lorem ipsum preview book

Text2McBook

๐Ÿ“š Convert any text file to a formatted text for minecraft books to use them as easily as possible ingame.

Issues? Found a bug?

Create an issue.

About

This script will convert text from a text file to a formatted minecraft book file. The file contains a native /give command which can be used ingame to get a writable_book with the text as content.
It supports different book formats which can be chosen with the parameter -f FORMATNAME.
I got inspiration from a post from r/admincraft.

Default

The default format will create a /give command which can be easily copied into a command block ingame to get the writable book. It will also format the text in a way in which it can be easily copy and pasted in a book in the game.

Denizen

Denizen is a scripting plugin for minecraft servers.
The denizen format will format the text for the text property in Book Script Containers. It will replace new line symbols with <n> and indents the line with 4 spaces to make it easily pasteable in the text properties of book script containers.

Installation

Python

Python (minimum: Version 3.10.4) needs to be installed on your machine.
Get it here.

Clone the repository / Download the latest release

Download the script:
Clone the repository or get the latest release here.

Usage

Create/edit the text file in the same folder where the python script is with the name text.txt and add your book text in there.
This is the text that you want to be converted to a minecraft book format.
Run the script: text2mcbook.py.
Now a booktext.txt file should be created.
In there is a /give command which can be inputted into a command block to get the book. There is also the formatted text which you can easily copy & paste in a book in minecraft.

Advanced Usage

Parametrs

This script supports the following parameters to change the usage for the script.

Get help about all available parameters

py text2mcbook.py -h

Input file

py text2mcbook.py INPUTFILENAME

Default: text.txt
Changes the input file.

Output file

py text2mcbook.py INPUTFILENAME OUTPUTFILENAME

Default: booktext.txt
Changes the output file.

Book format

py text2mcbook.py -f FORMAT
py text2mcbook.py --format FORMAT

Default: default
Possible Values: default, denizen
Changes the book format and the resulting formatting.

Characters per line

py text2mcbook.py -c NUMBEROFCHARACTERSPERLINE
py text2mcbook.py --characterlimit NUMBEROFCHARACTERSPERLINE

Default: 19
The number of characters one book line can have.
Warning: Don't set it to high or you are risking the loss of words!

Examples

Example 1

py text2mcbook.py book_to_convert.txt book_formatted.txt

Changes the input file to book_to_convert.txt and outupts the formatted book text to book_formatted.txt.

Example 2

py text2mcbook.py -f denizen -c 20

Outputs denizen formated text, which can be used in the text propert of Book Script Containers in Denizen. Also changes the number of characters per line to 20.

text2mcbook's People

Contributors

itzskyreed avatar neocky avatar somichev-dev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

text2mcbook's Issues

Can't use different languages/ Characters

I tried copying a different language into the program, but it gives an error

File "C:\Users\Sewak Singh Jabbal\Downloads\Text2McBook-v1.0.0\text2mcbook.py", line 11, in
text = f.read()
File "C:\Python310\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 25: character maps to

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.