/Write and /Setfont

For all mod-related questions and custom code.
Post Reply
Posts: 280
Joined: August 21st, 2011, 6:31 am
Location: United Kingdom

/Write and /Setfont

Post by Jonty800 »

Here are two commands that I wrote a couple of months back.

/Write is a command to write text in minecraft blocks. The code has been tested on mono and windows.

/Write is mainly used to decorate your server and can be used as a tool to create cool server logos. /Setfont is a command that controls /Write. It can set the font size and the font for the text.

When someone first uses /Setfont Font, a new folder is created called "fonts". In here, you can add any .ttf font and players can /Write with them

Have some screenshots:


The code is rather lengthy, so I'll pastebin each step for you

Step 1: Place this into buildingcommands.cs

Step 2: Create a new class file called FontHandler.cs and paste this

Step 3: Create a new class file called Direction.cs and paste this

Step 4: Add this into player.cs:

Code: Select all

//at the top
using System.Drawing;


public Font font = new Font("Times New Roman", 14, FontStyle.Regular, GraphicsUnit.Pixel);
        System.Drawing.Text.PrivateFontCollection FontC;
        public FontFamily LoadFontFamily(string fileName)
            FontC = new System.Drawing.Text.PrivateFontCollection();//passing memory space to FontC
            FontC.AddFontFile(fileName);//we add the full path of the ttf file
            return FontC.Families[0];//returns the family object as usual.
fCraft doesn't reference System.Drawing, so you need to do that manually. Users of Visual Studio / Express should already know how.

If you use this code, let me know if I missed out anything. Enjoy!

Edit: Oh and some of the comments are old. Ignore them :P
You cannot use certain BBCodes: [img].

User avatar
Posts: 25
Joined: May 28th, 2012, 12:03 am

Re: /Write and /Setfont

Post by OfficerFlake »

Holy fuck that's awesome. :wink:
=== MeinKraft 24/7 ===
Server Owner & Code Developer

Post Reply