Pages

Thursday, November 26, 2015

Minecraft Server Mods

My son today wanted to use a couple of his favorite mods on a server that I setup for him and his friend. I've setup plenty of vanilla minecraft servers, but never successfully one with Forge and mods installed.

The first thing to realize is the basic steps are the same as installing Forge mods on the client:

  1. Download the appropriate version of forge installer (Forge Site)
  2. Run the installer
  3. Start the server and make sure Forge is loaded
  4. Copy the mod to the mods directory
  5. Restart the server and make sure the mod loads
Some additional information will help. I'm doing this on a headless Ubuntu server so the instructions are tailored for that, but should be similar for other servers.

Installer

You want the plain installer download, not the installer-win or any of the others.
I don't have a GUI to my server, so I download files onto another PC and SFTP them to the server.
This process will create a new server setup, so go ahead and create your server directory now and put the installer in there to run it.

Run the Installer

In the new server directory, execute the installer with a command like this:
java -jar forge-1.7.10-10.13.2.1291-installer.jar --installServer
You will need to update the forge filename to match the version you are installing.
This should run for a while, downloading files and such, and then tell you it succeeded. There should be a forge "universal" file and a minecraft-xxx.jar file in the directory now.

Start the Server

To run the server, first copy the other server setup files. I have these available in a template directory. You need the edited eula.txt file and server.properties, and I include an ops.txt file to setup my initial operators.

When you start the server, you use the forge-XXX_universal.jar file in place of the minecraft.jar file.
So the command should look something like this:

java -Xmx1024M -Xms1024M -jar forge-YYY_universal.jar nogui

If it works, you should see some log messages with [FML] in them saying what Forge is doing.

FYI, on my headless server I don't want to keep a terminal session open the whole time the server is up, so I use the "screen" command to keep it running. I think screen is included by default in Ubuntu now. Anyway, the command I use is:

screen -S $sname -d -m /usr/bin/java -Xmx1024M -Xms1024M -jar $jar nogui

Once you are happy the server is up, just detach with Ctrl-A d. But in this case you can just enter the 'stop' command to shutdown the server.

Install the Mod

If the mod is just a jar file, celebrate!  Just put it in the new mods directory under the server directory. If it is a ZIP file, you at least have to unzip it. Then it may be a jar file, or a directory with class files. Both those options should work if you transfer them as-is into the mods folder.

MCHeli

This one is a ZIP file wth two folders, mcheli and META-INF. Take the mcheli folder out and put it directly in your mods directory. It should have an assets folder and another mcheli folder plus a couple files.

Restart Server

Restart your server using the same command as above. If it crashes, check that you copied the files correctly. Usually reading the first few lines of the crash report gives a hint as to what the problem is. If nothing else, google the first exception you see.




Thursday, October 29, 2015

Minecraft: Forge

Minecraft Forge is a basically a mod development kit and framework for Minecraft.

If you are a user, and not a mod developer, all you need to know is how to install the right Forge for your Minecraft version, and how to install mods once you have Forge. Okay, and I'll go over how to download the Forge version as well.

Recent versions of Forge have a very, very nice java installer. First, go to the download page at the Forge site, http://files.minecraftforge.net. Wow, they have just changed this page around significantly. Looks like you scroll down to where the Minecraft versions are listed, then select your version, then the page reloads, then you can click the Installer-Win icon for Recommended or Latest. I recommend Recommended.

On the next page, don't be fooled by the stuff on the page, just click Skip in the upper right corner.

This should start the download however that works for your browser. You should save the file, then open it when the download is complete.

When you run the installer it will look something like this:
This is a good time to confirm that you have the right version. Leave "Install client" selected and leave the path alone and just click Ok.

After a short time it should complete:

At this point, load the launcher and create a new profile.

And now your launcher should allow you to select the new version with Forge, like so:
That's it as far as installing goes.

Before you try to add a mod, though, you'll want to startup the profile first. Make sure the profile is selected in the launcher and click Play. Then wait for Minecraft to load. When it does, you should see the confirmation that Forge is active in the lower left corner:
Now you can should exit Minecraft. This little exercise allows Forge to create the mods directory, which is where you will copy your Forge-enabled mods.

The simple way to find the directory is to go back to the launcher, Edit Profile and click the Open Game Dir button. You will see a list of directories, including the new "mods" directory. Just copy your mod's jar file there and hit Play and that's all it should take.


Wednesday, October 28, 2015

Minecraft: The Launcher


Around version 7, Mojang came out with a new launcher for Minecraft. This new launcher easily manages multiple Minecraft versions and adds "profiles" and "game directories."

Before the new launcher, all Minecraft used a single directory in the user's AppData path. This meant that as you started using the game, creating worlds, adding mods and so on, it would all go in the same directory. Then if you wanted to play a different version of the game, you would still have most of the old stuff. It got very messy.

In the new launcher, we have Profiles. Profiles simplify using Minecraft for multiple different playing environments on a single computer. For instance, if you want to run version 1.6.2 with Flan's Mod, you setup a profile for that. Then if you want to run a different version with different mods, you create a new profile.




To create a profile, click on "New Profile" in the lower left corner of the launcher.



This will bring up the profile editor page.

This looks complicated, but for now you only need to worry about here things: the profile name, the game directory, and the version selected.

The profile name can be pretty much anything you want. Most people put the minecraft version or the name of the main mods they are using or something like that.

Above all, you need to check the "Game Directory" checkbox. This tells the launcher that you want to use a directory that is specific to this profile, and not lump all the profiles into a single location.
Then you just fill in the directory name.  I suggest putting all your game directories into the same parent folder, for example "C:\MC", and then add the name of the profile as the subfolder.

In the "Use version" dropdown box, just pick the version of Minecraft you want to use. It's that easy. If you've installed Forge for any versions, the Forge versions will be listed separately at the bottom of the list.

Save your profile, and you are done. One warning - when you go back to the main launcher page, you may be expecting the profile you just created to be selected, but usually it isn't. So change to the newly created profile before you hit Play!

Wednesday, November 20, 2013

IP Networks and Subnets

What Do All Those Numbers Mean?

Your basic network device needs a couple pieces of information to be able to send and receive traffic.

First of all, it needs an address. As you can see in Internet Addressing, it can have a host name type of address. But it always has to have a numerical IP address. If it has a host name, that's just so that we can type it in and a computer can look up the numerical address.

Ok, so each device has to have an IP address. We will talk here about "IPv4", which is the standard set of IP protocols we've been living with for decades. In IPv4, IP addresses are 32 binary digits, but they are normally written as four decimal numbers separated by dots.

For example, my server at home is 192.168.1.4. And my client machine is 192.168.1.22.

You see how the first bunch of numbers are all the same? That's because the client and the server are on the same network. You can call it a "subnet" if you like. A subnet is basically a bunch of computers that can talk to each other directly without going through a router.

So the next piece of information each device needs is a "subnet mask". A subnet mask looks like an IP address, but it normally starts with 255, which a normal IP address would never start with. The computer can tell if another computer is on the same subnet by comparing it's own address with the other address, and seeing if the subnet part of the address is the same.

In computerese, that might look like:
 
if ((my_address & subnet_mask) == (his_address & subnet_mask)) then
    send_packet_directly()
else
    send_packet_to_gateway()

A good point to note is that we don't care if the other computer's subnet mask is the same as ours. We only use our own subnet mask to make the comparison.

How does this help? Well, if I have another server on my network with the address 192.168.23.14, the subnet mask will determine if they are on the same subnet, which means they can talk directly, or if they are on different subnets and have to talk through a router (also called a gateway).

In this example, if the subnet mask is 255.255.0.0, then they are on the same subnet. But more commonly, the subnet mask would be 255.255.255.0, and they would be on different subnets.

That leads to the third piece of information your device will usually need - a default gateway. The default gateway is an IP address of a router (or "gateway") that will forward traffic for us to different subnets.

You can have very complicated networks with multiple routers handling different subnets, or if you are viewing this at home from behind your broadband router, you probably have only that router to worry about.

Let's look at some examples:

For my client machine at home,
    IP address = 192.168.1.22
    Subnet mask = 255.255.255.0
    Default gateway = 192.168.1.1

The first value will vary, but almost all broadband routers default to the subnet mask and default gateway shown here.

Another example - a computer in a lab at a university
    IP address = 10.9.25.100
    Subnet mask = 255.255.0.0
    Default gateway = 10.9.1.1

And a final example, for a really tiny network with only two devices on it,
    IP address = 192.168.27.2
    Subnet mask = 255.255.255.252
    Default gateway = 192.168.27.1


Tuesday, November 19, 2013

Common Ports

Commonly used port numbers

I'll add more to the list, but to start with:

Port Service
22SSH (Secure Shell)
23FTP (File Transfer Protocol)
25SMTP (Simple Mail Transfer Protocol)
80HTTP (Hyper-Text Transfer Protocol)

Internet Addressing

What are those numbers you told me to put in to reach my Minecraft server?

Well, a Minecraft game session is basically a network service connection. And most network service connections need to know two things:
  1. Which server am I trying to connect to, and
  2. What specific service on that server am I trying to reach?
This applies to lots of network stuff, like email, web connections, and whatever else the Internet is used for. Seriously, web and email cover 99% of it now, anyway.

The first item above is either an IP address (a bunch of numbers) or a host name (like www.minecraft.net). People work better with names, so web browsers and email clients let you put in the host name instead of making you type in a bunch of numbers. But in most cases, either one will work.

The second item is a port number. Many times, the port number is implied by what we are trying to do. Web browser traffic, for instance, is almost always going to port 80, which is the standard port for the HTTP network service. For sending email, our email client knows to use port 25 for the SMTP network service.

When we need to give both parts, I mean when we need to give the port number in addition to the host name or IP address, we put a colon after the first part and we add the port number. There shouldn't be any spaces or anything else in there.

For example, our Minecraft server address is 192.168.1.22:25565

And to reach my blog, you can enter grassrootslearning.blogger.com:80 in your browser's address bar. The ":80" isn't needed, but it works.

Here are some topics for further reading:

Host Names

How are host names made up?

Well, first of all, host name strings are a nice way to represent a network server, so that we don't have to remember a lot of numbers. (See Internet Addressing)

Host names usually have letters, sometimes numbers, and dots. The dots are not just to make them easier to read, they are "canonical". What that means is that the dots separate parts of the host name into different sized groups.

Most of the host name that you see, for example the "blogger.com" part of "www.blogger.com", is the domain name of the host. A domain is a bunch of computer systems all assembled under the same organization. So, for instance, Google manages all the computers in the "blogger.com" domain (not to mention google.com and a few others).

The ".com" part of the domain name is also a bunch of computers in the same organization, but of course they're not all owned by one company. But there is an organization for each top-level domain, and they decide if you are allowed to have your domain be a part of their structure.

Most examples you will see of host names have three parts - the host itself (www, perhaps), the company domain, and the top-level domain. But you can actually have sub-domains and sub-sub-domains and so on. So Google might have a host name like host9999.antwerp.servers.google.com.

Perhaps you are thinking "wow, so www.google.com is a network server. That must be one big machine to handle so much traffic!". Well it could work that way, but there are some tricks that domain administrators can use to do resource pooling and load sharing, so www.google.com actually represents a whole bunch of servers. But don't worry about that part just yet.

You might be interested in:
  • IP Networks and Subnets
  • IP Routing
  • Dynamic Name Service (DNS)
  • Dynamic Host Configuration Protocol (DHCP)