Regarding the change to UUIDs

As many are aware, Mojang is transitioning to using a unique, random identifier for each player rather than continuing the use of usernames. While player names are not completely going away (you will still see names over players’ heads and in chat), the problem is that it will no longer be guaranteed that a certain player’s Minecraft name will still be owned by that player once he or she disconnects. That may be caused by a player changing his or her name to something else, freeing up the older name for someone else to use.

Many things may actually not break

Since names are not going away and it’s only the 1-to-1 name-to-person correspondence that is going away, the change over to UUID may not be that dire. For example, if permission is given to “frank_m3256″ to use creative mode, there is no reason as to why old software would be unable to continue comparing names. When frank_m3256 signs on, he will receive his creative powers as usual. When the trouble develops is when Frank chooses to change his username. Nothing would break, but whoever takes the frank_m3256 name would then receive the powers of the original Frank. The original Frank, who would be using a new name, would not be recognized as the original Frank.

What’s involved in updating code for UUIDs

For most operations that need to work on players that are currently connected, the changeover to UUIDs does not present much of a problem.

When offline players are involved, the situation becomes much more complicated. When a player is logged onto a server, it is guaranteed that that player’s name is only assigned to that player. Remember, it’s when people disconnect that the 1-to-1 correspondence disappears. That results in complications for plugins, mods, and other projects that ask for a username once a player has disconnected from the game, because the code now needs to map the username to a unique identifier. While there might be a temporary cache to answer “what was the UUID of the last player connected that used this name?” it would not be wise to look there, because, if you recall, the name may be reassigned to someone else. The only way to actually accurately perform this name-to-ID conversion is to contact the Mojang servers and request for the equivalent UUID, which means these operations may need to now wait on a webpage request sent to Mojang.

The other difficulty regards plugins and mods that store data in the world. Imagine a chest that stored its owner in its NBT data: that name, as well as names of hundreds of other players, are now buried deep inside the data of blocks strewn across the world. Conversion of the names to the UUIDs cannot be done without actually opening every chunk and searching for names to change over. As noted previously, the fact that names are still used does not necessarily mean anything will break, but it may cause problems in the future for players that change their names.

Regarding my projects

As far as my projects go, we do plan to update for full UUID support.

  • WorldEdit is not particularly impacted by this change because it currently does not persist per-player data long after a player has disconnected.
  • WorldGuard has many names stored, primarily for region protection. Fortunately, this data is completely centralized, so it can be converted somewhat easily. An update should hopefully come out soon (as soon as time permits, rather) to add full support for UUID. It’s likely that nothing may break (if an update is not immediately available), but be aware about the issue with players changing their name.
  • CraftBook stores names on signs, which presents a problem because the unique identifiers in use by Mojang do not fit on the signs (nor did names, but there was only a 1 character length discrepancy). Me4502 is working on converting names to use an internal ID which will fit on the signs.
  • CommandBook is being updated to use UUIDs by Dark_Arc.
  • CommandHelper is being updated to use UUIDs by Lady_Caitlin.
Posted in Minecraft | 2 Responses

Easy JVM CPU profiling with WarmRoast

Usually when my server starts acting up, I pull out a JVM CPU sampler like JVisualVM. I usually choose to remotely connect, but I can’t say that it’s ever that enjoyable. Last night, I decided to make my own CPU sampler to make it a bit easier for myself, and for the others who help me manage the server.

Say Hello to WarmRoast

WarmRoast is a web-based CPU sampler for the JVM that has a few features specifically tailored for profiling Minecraft servers (and clients!):

  • Adjustable sampling frequency.
  • Supports loading MCP mappings for deobfuscating class and method names.
  • Web-based — perform the profiling on a remote server and view the results in your browser.
    • Collapse and expand nodes to see details.
    • Easily view CPU usage per method at a glance.
    • Hover to highlight all child methods as a group.
    • See the percentage of CPU time for each method relative to its parent methods.
    • Maintains style and function with use of “File -> Save As” (in tested browsers).

Read More »

Posted in Minecraft | 35 Responses

WorldEdit selections for Bukkit plugins

Here’s a quick guide to using the selection API for WorldEdit from a Bukkit plugin.

A large part of WorldEdit uses an abstract internal API for easy portability  For your convenience, we provide a Bukkit-native selection API that makes it easier to work with that part of WorldEdit. It is possible to “reach through” to access to the internal features of WorldEdit, but if you are interested in only getting selections, that shouldn’t be needed.

Getting a selection

To get a selection, you need to:

  1. Get a reference to WorldEditPlugin from Bukkit’s plugin manager.
  2. Cast the reference from JavaPlugin to a more specific WorldEditPlugin.
  3. Get the selection by calling getSelection().

See the snippet below.

Read More »

Posted in Minecraft | 11 Responses

Mirroring your Minecraft server

We moved our Minecraft server from Texas to Germany about a year ago, but we had to deal with the problem of the extra latency. It got worse when we found out that the data center’s connections had a bit network jitter that caused “pauses” at random times for users farther away. I wanted to do something about it, without moving back across the pond. Now there is a physical distance between two places on Earth, and there’s no magic you can do there, but some creativity can be applied to the trip itself. Because there’s no direct Internet cable between, for example, California and Germany, a packet has to travel through several “hops” along the way. While the Internet is pretty good at finding the best links between two places and the hops in between, depending on who a data center may “peer with” and many other factors, sometimes you can interject to improve the situation a little.

In our case, some people experienced network jitter, while others didn’t. Because it really depended on which hops the connections passed through, the idea was to force a connection through a better performing hop.


How do you do that exactly? By setting up a “proxy” Minecraft server at a strategic location, users who had network issues could connect to that instead, and that proxy server would theoretically have a better route to the real server. tl, dr; You can make your server perform better for everyone else in the world, not necessarily by leaps and bounds, but at least by a little!

This provided a sometimes massive decrease in both network jitter and sometimes latency issues. In our case, because the server was in Germany, Americans sometimes benefited a fair amount. This was especially true for those in Hawaii, which is quite a bit far from Germany, and a few Hawaiians noted that it was much better with the proxy.

Read More »

Posted in Minecraft | 37 Responses

Improving your Minecraft server’s performance

Sometimes running a Minecraft means struggling with server lag, and sometimes this struggle can keep you awake at night (maybe…). No one wants to play on a server where everything seems to lag, and it can be quite disconcerting to a server owner to know that his or her server isn’t as fun as it could be. It is not entirely hopeless, however; the first step to fixing a problem is to understand it.

As some who I have helped may know, aside from working on WorldEdit and friends, I’ve been a pretty big performance nut, having been the first person to write a /tps command for Minecraft! Reading through this article, you’ll find:

  1. An overview of the game logic loop
  2. How this all applies to modded servers
  3. An explanation of transient problems
  4. A guide to profiling your server
  5. A macro-view of improving performance

The game logic loop

The most important part of Minecraft is the game loop. In there is a clock keeping everything synchronized, going tick-tock at an ideally constant rate: twenty times per second, with each tick or tock lasting hopefully at most 50 milliseconds. During each cycle, game elements have to do their work — skeletons have to figure out where to walk, minecarts have to travel forward, grass has to spread, and light problems have to be checked. That’s a lengthy to-do list, considering how many blocks and entities are on a loaded world at at time (thousands). This tick-tock interval is called the tick rate or “TPS,” and you can get some mod or plugin to give you your server’s rate.


Quite a few things are on the to-do list, but as far as the “main game elements” go, those items are blocks, entities, and tile entities. Blocks include simple things such as sandstone, cobble, sugar cane, and things of that nature. Entities are your standard animals and monsters, in addition to paintings, item drops, and “objects that don’t fit perfectly on a grid.” Tile entities are a special kind of block, as they can hold any type of data (think storing an inventory, something sugar cane doesn’t have to do), and sometimes they must think separately. As previously mentioned, each loop has a budget of 50ms and each portion consumes some part of this pie. Any leftover time is considered idle.

Read More »

Posted in JavaScript, Minecraft | Tagged , , | 29 Responses

Make the Steam web client compact

Something wonderful I discovered just the other day was Steam’s web chat client, which is a nice changeover from the desktop application freezing all the time for me. Google Chrome users can make it a small window and make shortcuts for it with Chrome’s Tools -> “Create application shortcuts” under the main menu.

It’s all web-based and powered by HTML, and so with a few changes to the page to make it more compact…


To do the same, you’ll need Stylebot if you’re on Chrome, or something equivalent for other browsers (Stylish for Firefox). After installing Stylebot, navigate to the Steam chat page, click the “css” button in the address bar (it’s to the right), click the “Edit CSS” button on the new sidebar, and then paste in the code below:

Read More »

Posted in Games | 4 Responses

Version control all the things

Version control is practically essential to any software project, and it can be extremely useful even for your Minecraft server. What it does is simple: track any change, either large or small, knowing exactly who made the change, when the change was made, and exactly what the changes were. Software projects tend to use them because of those benefits, but if you aren’t already, there are many benefits to tracking every plugin, mod, or configuration change made to your server.

  • Easily spread around the work of updating the server (or corresponding client) with others. No more figuring out how to merge changes when you need to send files to other team members. Compared to Dropbox, you have far more tools available to you with a proper version control system — easily see differences down to individual lines.
  • Track every “release” of your server, which means that you can know exactly what was updated on what day, and most importantly, allow you to rollback to a prior release without having to scrounge around for the old files or old configurations.
  • If combined with a “deployment script,” you can just plug in a version that you want (i.e. release-2013-02-20) and your server could be automatically updated. Did the update go badly? Return to an old version (release-2013-02-16 perhaps?) instantly.

Read More »

Posted in Minecraft | Tagged , , , | 7 Responses

Minecraft server on a full disk

Recently, a Minecraft server I host used up all the disk space on its RAM drive, and consequently bad things resulted, but it further worsened by the fact that my friend kept the server running for eight hours more. The following is an explanation of what occurs when the Minecraft server keeps running but with no actual available disk space.

Running out of disk space

Does running out of disk space cause data loss? Not necessarily. Picture a chunk file as the example below, with three different chunks stored in different “slots.” The three squares represent disk space already “acquired” on the disk as one single .mca file, with the white areas representing acquired (from the PoV of a hard drive) but unused (from the PoV of Minecraft) space.


Sometimes a chunk needs to be enlarged, but only some activities do that. If you are placing down “simple” blocks like sandstone or cobble, you’re just changing a few bits of data in the chunk, so the chunk does not need to be resized. However, this is different when you add new entities (mobs, such as skeletons, or item drops, etc.) or new tile entities (more complex blocks, like chests, furnaces, etc.) because the existing space isn’t enough to store all the new data (think inventories!). Those changes require more disk space to store the chunk.


But even then, even if the hard drive itself is out of space, sometimes it is OK. The middle chunk above still has “room” to expand. The white space available was already, as mentioned previously, acquired on the disk.

The problems appear when the slot that the chunk is already contained within becomes too small to fit the newest version of that chunk. What happens is that a new free area has to be found in the file that can fit the chunk, but if that cannot be found, the chunk is placed at the end of the file. Placing data at the end of the file means that the entire file itself has to be enlarged, therefore requiring more actual disk space usage. When the hard disk is out of space, the extra data has nowhere to go. Because the header of the .mca file indexes where a particular chunk is stored, the index for this chunk may now point to this section of the file that cannot actually be written, causing the chunk to simply “disappear” on next load.


As seemingly irrelevant this information is to the world outside Minecraft, this also explains the same problem that your computer has when saving something to disk. When you save a file, it has the same, sometimes difficult, task: find a place to store the bits. If you’ve ever heard about “fragmentation,” that is when, rather than simply moving the entire file to another place, the file is split across across several areas. Of course, while Minecraft can put more data at the end of the file, your hard drive has a fixed amount of total space. The chunk format used by Minecraft does not do fragmentation.

Posted in Games, Minecraft | Tagged , , | 1 Response

Speaking of signature verification

One seemingly silly problem to deal with for those who host a “modded” Minecraft server is getting people to properly install those modifications. Copying a few files here and there seems simple enough, but it would be silly to say that connecting a backup generator to an electrical mains should be easy, just because it was easy to someone who dealt in the business. It comes down to an issue of numbers: if the difficulty was, for example, 10% harder, that could mean that there are 20% less people who can do it.

Several months ago, I updated my Minecraft launcher to support custom downloads and open sourced the entire launcher. While the update system worked pretty well, there was one caveat: it required that downloads be digitally signed, similar in principle to the browser verification of truly coming from Setting up digital signatures is pretty straightforward, but it’s a straightforward in the same vein as client installation – it is easy if you are familiar with the tasks involved. For that reason, as of today, I have decided to disable digital signature verification for custom packages, which should make it vastly easier (vanilla downloads from Mojang are unaffected). I was trying hard to avoid this, but other, more elegant options require a currently unrealistic input of time and effort from me.

tl;dr: I have made a change to my Minecraft launcher which vastly makes the use of the custom update feature easier to setup, which allows you to setup a custom modified MC client for people. Use it to make playing with friends less hectic, or use it to distribute necessary files for a modded server. After following the steps described within this post, you should be able to distribute your own files and install them into a user’s game. Towards the end of the post will be a discussion of some non-technical issues involved with this. Update to the latest version of the launcher to use this newest change.

Building the package


You’ll need three files:

  1. A .zip file containing the files to install. This archive should contain files that would be placed into the root Minecraft folder (aka. .minecraft).
  2. A package XML file containing a list of files to install, with a link to the ZIP archive.
  3. An update XML file containing a link to the package file and a version string.

Read More »

Posted in Minecraft | 21 Responses