Wishful Coding

Didn't you ever wish your
computer understood you?

Minecraft 1.8 (P)review

Like most Minecraft addicts1, I downloaded the prerelease this weekend and played it all day. There are some really cool things in there, but also a few crapy ones, and of course a few bugs and glitches.

My new home

I rally love the new biomes. I spawned in a desert biome, and if it wasn’t for the NPC village, I would have died for sure. Rivers are also great for exploring by boat.

I really like all the stuff that is specific to certain biomes. Without compasses and maps, it’s quite an adventure to get wood, animals and later vines and mushrooms from other biomes.

There are quite a few odd new items, like Ender pearls, rotten meat, and huge mushrooms, but they win on atmosphere, so I built my home in a shroom. Beat that, treehouse!

Mineshaft

The new map features all look really neat, but I found the abandoned mineshafts impossible to navigate. They cross right through strongholds, other caves and themselves.

The only thing I rally don’t like about the Adventure Update is the food and fighting mechanics. It’s like playing Quake 3 on peaceful2.

I’m not going to say anything about experience points, because I don’t know what they will be used for, but let me say that I don’t think Minecraft is a classic RPG.

The idea of food healing you indirectly is really nice, but having it replenish my life slowly makes me play as reckless as if I’m playing on peaceful. Maybe it could heal you while sleeping?

When you run, you are able to jump 4 blocks. Though, mid-air, you go faster than running, so the fastest way to move is to jump running. I pray that running diagonally isn’t even faster.

There is a new fighting mechanic that lets you deal critical hits by jumping down on a mob while hitting. This means the best way to fight is to jump up and down.

The last thing that adds to the Quake experience is hammering the mouse button. Previously, it was possible to place blocks and hit mobs by just holding the button, now you need to hammer the mouse like a real FPS. dislike

So, overall, I really enjoy 1.8, but can I say it’s having a bit of an identity crisis?

  1. Well, I played all Sunday, but except for that I don’t play much. 

  2. I Play on hard. 

CSS tips and tricks

While working on Sombrero, I encountered a lot of things I did not know how to do properly. I hope they help someone.

width: cling;

Block elements normally fill up all the available width, except when you apply position or float to them. I needed some element to take up the minimal width, without the side effects of floating or positioning. display: table; is the solution I was looking for.

Full-width form fields

Another problem in my magic alignment layout where full-width form fields. Input elements do not take space like normal block elements, no matter the display property.

width: 100%; works, but only as long as you have absolutely no borders, margin, or padding. To get around that, CSS 3 has a property to use the IE 5 box model, which includes padding and borders in the width: box-sizing: border-box;

Collapsing margins

I can’t imagine why I never noticed before, but it turns out CSS collapses margins on “regular” block elements. It’s complicated.

display: run-in;

I never used it, but it seems like an interesting property. It makes things like headings appear inline with the content of the block below it.

Styling range input fields

Some modern browsers support input fields of type="range", for imprecise number values. However, style on these elements is normally completely ignored.

Bring in -webkit-appearance: none;, which turns the slider track back into a normal box. Then apply the knob styling to the ::-webkit-slider-thumb pseudo element.

position all four corners

Another part in my alignment puzzle. Note that not all browsers support this. If you can’t do with 2 sides plus size, it is possible to specify all 4 and leave the sizing implicit.

Published on

Playing Minecraft Offline

Me and my friends like to play Minecraft sometimes, but it often happens to be in the middle of nowhere, without internet. The most interesting part is most often the setup, not the playing.

We usually start by sharing the latest Minecraft binaries and setting up an ad-hoc WiFi network. Then someone boots a server, and we’re set… NOT!

Minecraft usually performs some DRM and verification with the Minecraft website. For the server, this can be disabled by setting online-mode to false in server.properties, but with the client, you’re out of luck.

Initially, the solution consisted of sending someone with a smartphone out to find an open WiFi network. Later, before the new launcher, it used to be possible to fake the login server1. But recently, I found a way to play in offline mode on the client as well.

Spoiler alert: Minecraft is The Matrix.

Minecraft Matrix

That’s it. It had to be said. Now, let’s hack Minecraft Matrix style.

Normally, when you click “Play Offline” after a failed login, you are named “Player”, which means that you are going to kick each other because you all have the same name.

Now, fire up your terminals2, and change directory to the bin folder of your Minecraft directory3.

Now, I can’t read and write Matrix like Mouse4, but luckily, the GNU toolchain can. What we’re going to do is change a few occurrences of “Player” with any string of equal length5.

The first step is to extract the jar. It turns out it works just fine as a directory, and it’s much easier to work with that way.

mv minecraft.jar minecraft-orig.jar
mkdir minecraft.jar
cd minecraft.jar
jar -xf ../minecraft-orig.jar

Now we need to figure out which files need to be modified. Beware of Déjà vu!

grep -r Player .
# Binary file ./ei.class matches
# ./lang/stats_US.lang:stat.playerKills=Player Kills
# Binary file ./net/minecraft/client/Minecraft.class matches
# Binary file ./net/minecraft/client/MinecraftApplet.class matches
# Binary file ./ow.class matches

Some experimentation shows that MinecraftApplet.class is the one that matters. Now you need to use sed to replace “Player” with another name of equal length5.

Mac users will need to install GNU sed, as BSD sed scrambles the binary file beyond repair. I used brew install gnu-sed, but Macports and Fink might also work.

gsed -ibak s/Player/_Notch/g net/minecraft/client/MinecraftApplet.class

Done!

  1. Not anymore, it uses SSL now. 

  2. Mac users can use the “Homebrew” style at fullscreen for extra Matrix factor. 

  3. Mac: ~/Library/Application\ Support/minecraft/bin, Linux: ~/.minecraft/bin, Windows: ~/.AppData/Roaming/.minecraft/bin 

  4. Mouse, please tell me how you wrote the lady in the red dress. 

  5. Equal length you hear me, you’ll crash Minecraft otherwise.  2