Page 1 of 1

/Write and /Setfont

Posted: October 8th, 2012, 12:06 am
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:

Image
Image
Image

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

Step 1: Place this into buildingcommands.cs
http://pastebin.com/cNWeyArw

Step 2: Create a new class file called FontHandler.cs and paste this
http://pastebin.com/xrXHM5uh

Step 3: Create a new class file called Direction.cs and paste this
http://pastebin.com/Pj8h5d5t

Step 4: Add this into player.cs:

Code: Select all

//at the top
using System.Drawing;

//then

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

Re: /Write and /Setfont

Posted: October 8th, 2012, 2:37 am
by OfficerFlake
Holy fuck that's awesome. :wink: