It is currently October 19th, 2018, 5:14 am


All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: /Write and /Setfont
PostPosted: October 8th, 2012, 12:06 am 

Joined: August 21st, 2011, 6:31 am
Posts: 280
Location: United Kingdom
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:
//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

_________________
You cannot use certain BBCodes: [img].


Top
Offline Profile  
Reply with quote  
 Post subject: Re: /Write and /Setfont
PostPosted: October 8th, 2012, 2:37 am 
User avatar

Joined: May 28th, 2012, 12:03 am
Posts: 25
Holy fuck that's awesome. :wink:

_________________
=== MeinKraft 24/7 ===
Server Owner & Code Developer


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net