Minecraft Sword Hits When You Do

Introduction: Minecraft Sword Hits When You Do

Tinkernut recently did a live comments show where he was looking for suggestions from his audience for new projects. He mentioned doing a project where a person could swing a sword in real life that would cause a sword in Minecraft to also swing. Here is that project.

Step 1: Design

I started this project by going into Fusion 360 and inserting an image of a basic Minecraft sword. Then I traced it to create an outline of the sword. After extruding the shape I generated GCode from it for use in my CNC router. Additionally, I created a PCB using Eagle that would use an ESP8266 ESP12e and Bluetooth to communicate with the PC.

Step 2: Creating the Sword

I cut out the sword design on my CNC router and then traced the sword onto some foam. I then sandwiched the foam between the plywood pieces. Finally, I painted the sword by first drawing the "pixels" and following the iron sword design.

Step 3: The PCB and Electronics

After using chilipeppr.com to generate GCode from my PCB design, I milled a blank copper-coated FR4 board using a 1/32inch router bit. Next I soldered on the ESP12e module and other connectors.

I then attached the board to the sword (my ESP12e module was broken)

Step 4: The Code

There is code needed for both the ESP12e and the host PC. The ESP12e simply reads accelerometer data from the Sparkfun 9DoF stick and if it exceeds 2g of force it sends a message over serial. The python script runs on the host PC. It waits for the serial data from the ESP12e and then uses pyautogui to click the mouse.

Step 5: Using It

All that is needed is for a user to simply plug in the module into the PC, run the python script, and then have fun! Just swing the sword and the Minecraft character will swing it's sword as well.

Be the First to Share

    Recommendations

    • Pocket-Sized Speed Challenge

      Pocket-Sized Speed Challenge
    • Super-Size Speed Challenge

      Super-Size Speed Challenge
    • Audio Challenge 2020

      Audio Challenge 2020

    2 Discussions

    0
    Penolopy Bulnick
    Penolopy Bulnick

    2 years ago

    Fun idea! Can you use the physical sword with any tool or weapon in the game?

    0
    Arduino_having11_Guy
    Arduino_having11_Guy

    Reply 2 years ago

    Yup. It basically just does a left mouse click. A pickaxe might not work but for hitting stuff it works well.