Category / Minecraft

Columnized text in Minecraft Chat February 4, 2015 at 8:11 pm

Minecraft uses variable width fonts in the chat output during gameplay. For plugins that benefit from displaying tables of data this will cause issues. It isn’t possible to just use spaces to align columns of data. Any text that contains characters outside of the ‘normal width’ will cause columns to be pushed to one side or the other.

Most characters are equivalent to six pixels in width. The ones that cause problems are not the same width. The biggest troublemaker is ‘space’. A space is rendered equivalent to four pixels wide. You could almost ‘fix’ the problem filtering out troublesome characters, but the output would unpleasant.

While searching for a solution I ran into an implementation that came very close to fixing the issue, but still had minor misaligned text which was highly visible and distracting to me. Not being happy with the improperly aligned text I started doing some tinkering and testing various unicode characters for width. I was able to stumble onto an unobtrusive character that seems to be on most platforms AND (more importantly) is the equivalent to one pixel wide.

In addition to fixing the problem with misaligned text I was able to add the ability to ‘properly’ align numbers to the right (for those of us using left to right rendering fonts).

Tables of output for the SimbeyMod teleport feature:
tp1

The implementation allows for left, right, and center alignment for columns. In addition the behavior keeps the table only as wide as required for the widest display area needed and will collapse ‘less important’ information as required.

Dynamic sizing of the ‘Name’ Column:
tp4

Dynamic removal of ‘less important’ Column:
tp5

I ended up with following solution:

Usage:

Ernie

Mmm… Tastes Like Chicken. April 15, 2014 at 1:03 pm

This is almost complete. I still need to add the “murder circuit.” And I was wondering if I ~should~ route the “culled” chicken into the ovens. Hmmm….
2014-04-15_12.56.22

On a clock, a pulse of water collects stuff in the pen.
2014-04-15_12.56.51

2014-04-15_12.56.55

Perpetual Redstone Repeater loop circuit that sends the pulse. Initialized by hitting a button twice. With a little more room (I have a couple more layers!) I could initiate the pulse automatically.
2014-04-15_12.57.19

Output is sorted…
2014-04-15_13.07.02

Way too much time on my hands these days… April 11, 2014 at 6:42 pm

When I first built my “lair” I thought it was “huge.” Hah.
2014-02-16_15.56.12 2014-04-11_18.47.47

Outside view of the transformation of my “island.” I wish I had a screen shot from before the building and crafting insanity. (Recreated the world…)
2014-04-19_09.43.24

2014-02-18_10.16.04

2014-02-23_03.19.40

2014-04-10_00.46.09

2014-04-19_09.53.44

“Magic” Chicken Farm
2014-04-11_18.55.19

“Magic” Ovens.  (I could have gone with more, but this is typically faster than I can typically use what I drop into the ovens anyway!)
2014-04-11_18.56.33