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.