Blog Feed

Harry Potter Witchcraft and Wizardry Minecraft Server and Client Setup

Setting up a Minecraft server and configuring the Minecraft client shouldn’t be that hard, and it isn’t, but I couldn’t find comprehensive instructions in one place. Part of the problem may be that there are lots of options. Here is one way to do it with some notes and links to other possible options along the way.

This will be easier if you’re familiar with the command line and have used a cloud hosting service before, but hopefully possible to follow even if not.

TL;DR

  • Create a t3a.large instance running Ubuntu 18.04
  • Add inbound rules to the security group:
    • TCP port 25565 from any address
    • UDP port 19132-19133 from any address
    • UDP port 25565 from any address
  • ssh in to your server
  • apt-cache search openjdk
  • sudo apt-get update
  • sudo apt-get install openjdk-8-jdk -y
  • mkdir ~/minecraft
  • cd ~/minecraft
  • wget -O minecraft_server.jar https://launcher.mojang.com/v1/objects/3737db93722a9e39eeada7c27e7aca28b144ffa7/server.jar
  • Start the server for the first time:
    • I recommend starting the server with tmux, screen, in the background, etc. so that it keeps running even if you disconnect.
    • cd ~/minecraft
    • echo "eula=true" > eula.txt
    • java -Xmx2G -Xms2G -jar minecraft_server.jar nogui
    • Check if it’s working at https://mcsrvstat.us/
    • Type stop to stop the server
  • Adding the Witchcraft and Wizardry mod:
    • Edit the following lines in ~/minecraft/server.properties:
      • enable-query=true
      • allow-flight=true
      • enable-command-block=true
      • resource-pack=/home/ubuntu/minecraft/resources
    • Copy the file at http://www.mediafire.com/file/liv31yxjsna3pfo/Witchcraft_and_Wizardry.zip/file to the home directory of your EC2 Instance
    • Place those files with the commands:
      • cd ~
      • sudo apt install unzip
      • unzip Witchcraft_and_Wizardry.zip -d ./Witchcraft_and_Wizardry
      • mv Witchcraft_and_Wizardry/resources.zip minecraft/resources.zip
      • unzip minecraft/resources.zip -d minecraft/resources
      • rm -rf minecraft/world/*
      • cp -r Witchcraft_and_Wizardry/* minecraft/world/
    • Now you can restart your minecraft server with
      • java -Xmx2G -Xms2G -jar minecraft_server.jar nogui
  • To set up your client,
    • Open the minecraft launcher
    • Create a new install with version 1.13.2
    • You need to put the unzipped Witchcraft and Wizardry/resources directory in your resourcepacks directory
      • You can find the directory by going to the menu and selecting Options… -> Resource Packs… -> Open Resource Pack Folder
      • Once you’ve copied the unzipped resources folder, close and reopen the Resource Packs screen to refresh the options
      • Click the new pack to move it to the right side, click Done, and go back to the game
    • Now when you connect to the server the Witchcraft and Wizardry content should load properly!

Configuring Your Server

Setting up an AWS Instance

I’m going to use an Ubuntu server running on AWS. You could use a different OS and/or a different hosting service. There are instructions for other OSes here.

First, go to the AWS console (amazon account required), go to the EC2 section, and click to launch an instance.

Select “Launch Instance” from the EC2 console

I selected the Ubuntu Server 18.04 LTS server for x86 and a t3a.large instance type. The free tier, t2.micro, probably doesn’t have enough compute or RAM to run minecraft well. But the t3a.large only costs about 8 cents an hour and you can shut it off when you’re not using it.

Select Ubuntu 18.04
Select a general purpose instance type. I used t3a.large.

Click “Review and Launch” and then on the next page “Launch” to accept the defaults. You’ll get a popup prompting you to create a key pair. This will let you ssh in to your instance once it’s launched. Create a new key pair, give it a name indicating that it’s for your minecraft server, and click “Download Key Pair”. Note where the .pem file gets downloaded. The location doesn’t matter but you’ll have to use the location later.

Create a new key pair and download it.

Then you can click “Launch Instances”. Once the progress screen finishes you can go back to the EC2 console to view your new instance. There’s also a button on the bottom right hand corner you can click to view your instances.

WARNING: You will be charged for any time your server is running. When you’re done with it, be sure to click Actions -> Instance State -> Stop. You can do the same thing and select Start to restart it later. If you select Terminate, the server will be gone forever and you’ll have to start over with a new one.

Remember to stop your instance when you’re done.

While we’re here, we’ll set the inbound network rules for our security group. Click on the launch-wizard-X link next to “Security groups”.

With your new instance selected, click on its “launch-wizard-X” security group.

Now select the security group with the same name you clicked on, select the “Inbound rules” tab, and click the “Edit inbound rules” button.

Edit the inbound rules for your instance’s security group.

Click “Add rule” to add three rules:

  • Custom TCP port 25565 from any address
  • Custom UDP port 19132-19133 from any address
  • Custom UDP port 25565 from any address

You can restrict the addresses in the “Source” column, but then you need to know the IP addresses of any the players you intend to have join your server and will have to update these settings if your players’ IP addresses change.

Then click “Save Rules” to finish the inbound network settings.

Add three new rules and click “Save rules”.

Now go back to the EC2 console and note the public IP address of your server. You’ll need this both to ssh in to your server and to put in the Minecraft client to connect once your server is running.

Note the IP address of your server

Install Minecraft Server

If you haven’t used ssh before, it should be built in to Terminal on macOS and any flavor of Linux. If you’re on Windows, options include Windows Terminal and Git Bash.

Set the permissions on your .pem key with the command:
chmod 400 /Users/parker/Downloads/minecraft-demo.pem

ssh into your server using the path to the .pem file and the IP address noted in the previous step, for example:
ssh -i /path/to/key.pem ubuntu@3.90.140.166
If you get a questions about the authenticity of the host, just say yes.

Now that you’ve ssh’d in to your EC2 instance, run the following commands:
apt-cache search openjdk
sudo apt-get update
sudo apt-get install openjdk-8-jdk -y

Now download and run the minecraft server. We’re going to use 1.13.2 because that’s what the Witchcraft and Wizardry mod works with.
mkdir ~/minecraft
cd ~/minecraft
wget -O minecraft_server.jar https://launcher.mojang.com/v1/objects/3737db93722a9e39eeada7c27e7aca28b144ffa7/server.jar

I like to run in tmux so that the minecraft server doesn’t go down if I lose connection to the EC2 instance. You could also use any number of other methods, including screen and running in the background. I’ll show the commands for tmux:
tmux
cd ~/minecraft
echo "eula=true" > eula.txt
java -Xmx2G -Xms2G -jar minecraft_server.jar nogui
You can change the -Xmx and -Xms values to something other than 2G to change the amount of memory available to the server.

If you get disconnected from your ssh session, once you reconnect you can tmux attach to get back to the tmux session that was running previously.

Once the server has started up (it took maybe 15-30 seconds on this EC2 instance), you can check if it’s actually accessible at https://mcsrvstat.us/
Just put in your EC2 instance’s IP address to check. If it doesn’t connect, probably your minecraft server didn’t start up properly (check the output for errors) or your EC2 instance’s inbound network rules are not correct.
I got some warnings about the server not being able to keep up, but didn’t see any issues during gameplay.

Now that you’ve run the server once, type stop to stop the server and we’re ready to install the Witchcraft and Wizardry mod.

You need to edit the server.properties file. You can use any text editor, but Nano is a good one to start with if you haven’t used terminal-based editors before.
nano server.properties
Change the following lines:
enable-query=true
allow-flight=true
enable-coommand-block=true
resource-pack=/home/ubuntu/minecraft/resources

On your local computer:
Download the Witchcraft and Wizardry zip file from http://www.mediafire.com/file/liv31yxjsna3pfo/Witchcraft_and_Wizardry.zip/file
Open a new terminal and copy this zip file to your EC2 instance (You can’t (and are not allowed to) use programs to download from mediafire and I couldn’t find a url that would work with wget)
Rename the downloaded file to Witchcraft_and_Wizardry.zip
scp -i /path/to/key.pem /path/to/Witchcraft_and_Wizardry.zip ubuntu@<ip>:~/

Back on your EC2 instance ssh session:
cd ~
sudo apt install unzip
unzip Witchcraft_and_Wizardry.zip -d ./Witchcraft_and_Wizardry
mv Witchcraft_and_Wizardry/resources.zip minecraft/resources.zip
unzip minecraft/resources.zip -d minecraft/resources
rm -rf minecraft/world/*
cp -r Witchcraft_and_Wizardry/* minecraft/world/

Now you can restart your server with
cd ~/minecraft
java -Xmx2G -Xms2G -jar minecraft_server.jar nogui


Installing Client

Each player will have to install Minecraft and the Witchcraft and Wizardry mod on their own computers, then connect to the Minecraft server you just set up by using your EC2 instance’s IP address.

Remember, you’ll need Minecraft 1.13.2. To get this, download the latest Minecraft here.

Once Minecraft is installed, launch it and click “New…” to add a new minecraft version.

Click “New…”

Now select version 1.13.2 and give it a name of your choice, then click “Create”

Create a new installation of 1.13.2

Go back to the install list and select your new installation. Click play, then select Multiplayer when the game starts up.

Select Multiplayer

In the Multiplayer screen, choose “Direct Connect”.

Click “Direct Connect”

Enter the IP address of your EC2 instance, then click “Join Server”. Note that this will change each time you stop and re-start the instance from the EC2 console.

Enter your EC2 instance’s public IP address

After a few seconds, you should be connected to the server but are likely stuck on a black screen and unable to move. This is because we haven’t set up your local resources folder with the Witchcraft and Wizardry bundle yet. Press escape to bring up the game menu and then click “Options”.

Click “Options…”. Note that my background is not blank because I’ve already installed Witchcraft and Wizardry

Now click “Resource Packs…”

Click “Resource Packs…”

Click the “Open Resource Pack Folder” button to open a folder on your computer. You need to unzip the “Witchcraft and Wizardry.zip” file you downloaded earlier, then rename the “resource.zip” folder to “witchcraft-and-wizardry.zip” and copy that folder into the location opened by the “Open Resource Pack Folder” button.

Click “Open Resource Pack Folder”

Now click “Done” on the resource pack screen in Minecraft and click “Resource Packs…” to refresh the list of resource packs. The Witchcraft and Wizardry pack should now be on the left. Click on its icon to move it to the right to indicate you’d like to use it.

Witchcraft and Wizardry resources now available on the left. Click to move it to the right.

Now that the Witchcraft and Wizardry pack is on the right, click “Done” and exit out of the menus. Click “Back to Game” in the Game Menu screen.

Click “Done”

Once you’re back in the game, you should see Hogwarts and “Press F to start” on the screen. Press “f” on your keyboard, then use the scroll wheel on your mouse to move over to “Multiplayer” and press F again to select it.

You’ll get walked through some menus and eventually get to a screen telling you how many players are connected. Once everyone is connected, press F again to start the game!

Sonic Screwdriver

Originally Published: TUESDAY, JUNE 23, 2015 AT 12:10PM

Making a 3D-printed Sonic Screwdriver

In addition to the Tardis, the sonic screwdriver is probably the object most associated with The Doctor. The sonic screwdriver is a sort of all-purpose device that acts as a sensor, emitter, and interface to electronics. Its signature function, however, is its ability to unlock (almost) any door. When I realized that I could use a keyfob to make a sonic screwdriver that actually unlocked doors, I knew this was going to be my next project.

Finished Sonic Screwdriver

This sonic screwdriver is modeled on the most recent prop used in the Dr. Who show, commonly referred to as “the eleventh Doctor‘s sonic screwdriver”, though it is not exclusive to the 11th doctor. I didn’t have actual dimensions for the prop or any of the various toys and replicas that are commercially available. However, there is abundant reference on the internet and I attempted to make my screwdriver close to the actual prop without trying to exactly match every detail. I did not use actual measurements, proportions may not be quite correct, and the overall size was constrained by the components I used inside, and is thus significantly larger than the actual prop.

In addition to a recognizable outside (which I will refer to as the case), I had a few requirements:

  • a green light that turned on when a button was pressed.
  • a sonic screwdriver sound effect plays in a loop when the same button is pressed.
  • the sonic screwdriver can unlock doors at my office via the HID card readers.

There are several guides to making a sonic screwdriver, each with a slightly different set of functionality. I didn’t find any that were exactly what I wanted to do, and most had more complex electronics for sound effects than what I settled on. I found this instructables guide most inspiring but still not particularly applicable to my design.

Since my sound effect was sufficiently simple I was able to use Adafruit’s Audio FX Sound Board. This saved me a lot of time and is quite small for a microcontroller with its capabilities, but it was still the limiting factor in how small my sonic screwdriver could be (it is noticeably larger than the actual prop).

Components

  • A sound file to play (The one I used is here, adapted from this Youtube video).
  • A speaker (I bought this one, and this one also looked promising). It’s surprisingly hard to find a small enough 8 Ohm speaker.
  • A green LED (I got this pack of 100. Nice because it comes with the appropriate resistors and is available in other colors)
  • A button. I got a set of these to play with
  • An Adafruit Audo FX Sound Board. This little board is surprisingly versatile and incredibly simple to use. No coding, bootloading, or complex wiring necessary. I would highly recommend this for a large variety of prop type projects.
  • A battery. It has to be at least 3 Volts (I tested with up to 4.5 Volts) and be able to provide enough current. Three 1.5 V watch batteries in series were not enough. I used a battery very similar to this duracell battery.
  • Some wire, a soldering iron, electrical tape or heat shrink
  • Paints. I used acrylic paints from Golden Paints for the metalic colors (“Iridescent Copper” and “Iridescent Pearl”) and Blick brand acrylics from the Blick art store for the matte colors (“Mars Black”, “Emerald Green”, and “Titanium White”. I’m sure you can find similar acrylic paints at a local art store or online.
  • A 3D printer (I used a Form 1+).
  • There are 3 stl files: case tophandle, and handle base. There’s also a Form file if you want to print on a Form 1+.

Optional Components

  • A Key Fob (or other RFID type chip) that already opens the door you want your sonic screwdriver to open.
  • A heat gun (if you’re going to mod a keyfob, see section 3 below)
  • An OnShape account (if you want to modify the case models. At the time of writing you can sign up for free access to the beta but it takes about a day to get activated)

1. Print The Case

Print out the sonic screwdriver components. I used a Form 1+ with Grey Resin. If you wish to make changes to the models, the OnShape document is here. An account is required, but you can sign up for a free account and then access, view, and copy that document to make your own changes.

One modification you may wish to make is adding holes for the speaker. The speaker is quite loud outside the case, but once the screwdriver is all closed off it’s much quieter. You may want to add some holes to the upper case before printing, or you could try drilling them after.

Case 3D printed on a Form 1+

2. Wiring

The effects board would barely turn on when I had the LED in series with it. Presumably there was too much of a voltage drop. So I just wired them in parallel. You do have to have a battery that has sufficient current to drive both circuits.

The wiring diagram is as follows:

Wiring Diagram

It will be difficult to wire everything up first and then get everything in the case. Nevertheless, it might be useful to see the actual components wired together, so here’s an image:

Wired Components

Assembling the components, perhaps with minimal soldering, could also be useful for testing that you know how everything goes together, but keep in mind that if you do this you’ll have to take it apart to perform the final assembly.

3. Fob Key (optional)

My office has standard HID fob keys. The full key does not fit inside the sonic screwdriver, but I discovered that it is possible to roll these fob keys to make them small enough without breaking them.

Split open the case by running a razor blade along the seam and prying it open. One side is just the case, the other has the electronics (a wire coil and an incredibly tiny chip) and the other side is just a case.

Split Fob Key

Cut off the loop and, very carefully, the excess plastic around the coil. Wire snips cut through the soft plastic very easily. Still, if you break any of the incredibly fine wires in the coil, the fob will no longer work.

Trim Excess Plastic

Test that the fob key still works with your door. Now use a heat gun to heat the plastic until you can start to bend it. It’s easier if you wear a heat-resistant glove because then you can continue to apply heat while bending the plastic against a surface like a tabletop. The plastic should soften but not melt. Be careful to not overheat or bend too sharply. I recommend bending in small increments and testing the key fob after each manipulation. If you accidentally cause one to stop working, you’ll get a feel for how much stress it can take.

Bending a Fob Key

I was surprised by how resilient thes fob keys were, but the more distorted they are, the shorter their range is. I went through a few before I was able to get one that fit in the screwdriver and still activated the door through the case.

4. Sound FX Board

Perhaps the best part of the Sound FX board is how easy it is to load sound files. Connect it to your computer with a micro-USB cable and the board mounts as a standard USB drive. Then you can drag and drop the file through your system’s file browser.

My file is T02HOLDL.wav which means it will play on a loop (L) while pin 2 (T02) is connected to ground (HOLD). Adafruit has a much more detailed discussion of file naming and loading in their product tutorial.

NOTE: Some cheap micro-USB cables will deliver power to a device (e.g. for charging) but do not have the data lines necessary to actually move files to and from the device. If your Sound FX board does not appear as a USB drive when you connect it to your computer, you probably have one of these power-only USB cables. Adafruit sells a micro-USB cable.

For my circuit design I wanted the sound to play whenever the Sound FX board had power, so solder a wire connecting ground and pin 2.

Sound FX board with pin 2 connected to ground

4. Assembly

1. LED

Solder the resistor to the annode of the LED (the longer lead), then add lead wires that are long enough to reach through the sonic screwdriver. The ground wire needs to reach the battery ground, so should be longer than the fully assembled screwdriver, and the wire connected to the resistor needs to reach out of the top section of the screwdriver and connect to the lead coming off the button.

Once the LED is wired, push it up from the inside throught the hole at the top of the screwdriver. I applied some super glue around the edge of the hole from the outside to hold the LED in place.

2. Keyfob (optional)

Insert the keyfob or equivalent into the top section of the screwdriver case. Be sure to test that it still unlocks the door from within the screwdriver. Once you’re sure the position is correct, find some way to secure it in place, such as glue or tape.

3. Speaker

Since the Sound FX board only goes in the bottom of the handle section of the case, make sure that the speaker leads will reach out of the top section of the case and through the handle section. This way you can thread the leads through the handle section and solder them to the Sound FX board while it’s outside the case. Glue the speaker in place inside the top section of the case. At this point the top section of the case should have the two speaker leads and the two LED leads coming out of it.

Top Case with Speaker and LED Leads

4. Button

Solder one wire to one side of the button, long enough to reach out of the handle and attach to the battery. Solder two wires to the other side of the button. One needs to reach out the bottom of the handle to provide power to the Sound FX board. The other can be shorter: it only needs to go out the top of the handle and get connected to the LED’s lead. The button sets in from the outside, so put the wires through the hole that will hold the button, thread them out the appropriate openings, and place in the button. Use some glue to hold the button in place.

Button with Wires
Button in Case Handle

5. Final Connections

Solder the speaker leads to one of the amplifier channels on the Sound FX board.

Solder the Anode lead wire from the LED to the short wire coming out the top of the handle from the two-wire side of the button.

Solder the long wire from the two-wire side of the button to the Vin hole in the Sound FX board.

Connect the lead wire from the single-wire side of the button to the positive terminal of your battery. Connect the Sound FX board’s ground pin and the LED’s cathode wire to the negative terminal of your battery.

I didn’t have good contacts for the battery and was getting impatient, so I soldered directly to the battery. This was both difficult and dangerous (because lithium batteries can catch fire and/or explode). It would be much better to use electrical tape to hold contact pads (e.g. pieces of conducive tape) that are in turn soldered to the wires. If you do try to solder to the battery, I found I hald to scuff up the negative end with a file before the solder would stay on. This, too, was probably a dangerous solution.

6. Finish Assembly

Test that everything works now that you have it all wired together.

Carefully push the Sound FX board into the case handle, curl the excess length of any wires and push them into the case, then connect the three pieces of the case. Mine press-fit together nicely, without modification, but you could sand them if they’re too tight or add some glue if they’re too loose.

Assembled Sonic Screwdriver

Paint

I applied accrylic paint directly onto the printed part. I had to apply two coats to the silver parts and several coats to the white handle. You could spraypaint with some primer first, which would help the paint last and perhaps require fewer coats.

Here’s an image of my fully assembled, painted screwdriver.

Painted Sonic Screwdriver

Lava Tutorial

Originally Published: TUESDAY, FEBRUARY 4, 2014 AT 7:15PM

For Brown’s CS 128 (Intermediate 3D Computer Animation) class, I created a mountain scene with lava. The project was done primarily in Maya. At the time I found minimal reference for creating a lava flow in Maya, so I’ve recorded a tutorial describing the basic method that I used to generate the lava in that scene.

In this tutorial I reference Duncan Brinsmead’s example, which you can find here. The file I started with in my tutorial is here, and the final result I had at the end of my tutorial is here

There’s obviously a lot more you can do to improve the realism in this scene, but I hope that it might be useful as a starting point.