I was looking for ideas in /r/SethBlingSuggestions for what to create in minecraft, and I found a post
asking if he could make throwable tomahawks in vanilla minecraft.
Now I may not be SethBling, but I decided to give it a crack and loaded up my minecraft world.
Overview
(Warning, there is some bugs still)
A tomahawk is an iron axe, which can be thrown. By pressing "Q" on the keyboard, you can throw the axe, and
it has a cool spinning animation (See fig 1)
It can be thrown in 8 directions, being the 4 cardinal directions and the 4 ordinal directions.
When the tomahawk hits a block, it will drop to the floor.
Explanation
(This part is long, if you're not interested in how the redstone works, skip to the bottom of the page for the download)
There are a few sections of the build, those being;
Testing for the direction that the player is facing, The throwing mechanism and animation, Dealing damage to mobs and
Testing to see if the tomahawk is touching a wall.
Player Direction
(See fig 2)
A redstone comparator clock is connected to a commandblock, which tests the rotation of the player using the command
/testfor @p[ry=*Rotation*,rym=-*Rotation*]
If the player is rotated between these numbers, the comparator activates, putting a signal out to the second command block, which places a redstone
block that starts the clock for the throwing mechanism detection. The block on top activates when the previous command block is unpowered, placing an
air block at the place the redstone block was. The setblock command is
/setblock x y z redstone_block
Throwing Mechanism (Detection) + Animation
(See fig 3)
A redstone clock (Activated by the player direction detector) is connected to a command block (closest) that executes at the player to set the score of an objective
( /scoreboard objectives add Tomahawk dummy ) to any item within one block that is named "Tomahawk" using the command
This will set the score of the tomahawk to 1 when the player throws it. There is a 2 redstone tick delay, then the score is reset.
/scoreboard players reset @e Tomahawk
There is another command block attached to the clock (Furthest) that executes at any item with a "Tomahawk" score between 0 and 1 with the command
to place a redstone block at the animation section.
/execute @e[type=Item,score_Tomahawk=1] ~ ~ ~ /setblock x y z redstone_block
When this is completed, it kills all items named "Tomahawk"
/kill @e[type=Item] {CustomName:"Tomahawk"}
When the redstone block powers the animation section, it is deleted by the block on top,
/setblock ~ ~-1 ~ air
then the redstone signal is sent through a line of command blocks. The first two command blocks execute at the player to spawn in an invisible armour stand with the rotation that the player is facing, holding a tomahawk and place a redstone block at the mob damage section.
The next pair of command blocks teleport the armour stand forward half a block in the direction that the armour stand is facing (and a little up or down), and change the entity data of the armour stand so that the arm holding the tomahawk is rotated on the y axis.
This is repeated 21 times with a 2 redstone tick delay, whilst teleporting the armour stand up or down slightly to make an arc.
The single command block sitting next to the second last pair of command blocks executes at the armour stand to summon the tomahawk item at it's position.
There is a 2 redstone tick delay between the second last and last pair of command blocks, allowing time for the tomahawk to be summoned before the last pair places a block of air to deactivate the mob damage section, and kill the armour stand.
/setblock x y z air
/kill @e[type=ArmorStand,name=Tomahawk]
Mob Damage
(See fig 4)
Each of the command blocks connected to the redstone clock executes at the armour stand named "Tomahawk" to either give the effect instant damage (normal mobs), or instant health (undead mobs) so that it damages them, within a range of 1 block.
Though testing for every single mob may seem redundant, to avoid healing undead mobs instead of harming them it is necessary.
Testing if the tomahawk is touching a wall
(See fig 5)
A row of 8 command blocks connected to a redstone clock execute at the armour stand name "Tomahawk" to test for a block of air two blocks away in each of the 8 directions.
This output is connected to a redstone torch, when succesful it will turn the torch off, so that when a block two blocks in one of the 8 directions isn't air, it activates the next command block. The next command block executes at the armour stand named "Tomahawk" to summon the tomahawk item at it's location.
Amazing!! Really like you what you have created. I am guessing you are inspired by SethBling's work?
Yeah, I watch all of his videos. Though I am inspired more by Dragnoz, that guy can come up with the most amazing stuff! You should check him out on youtube sometime.
Yeah, I watch all of his videos.. Though I am inspired more by Dragnoz, that guy can come up with the most amazing stuff! You should check him out on youtube sometime.
I like Dragnoz too. He has made stuff like RPG Classes in Minecraft to Elemental arrows. SethBling is pretty cool aswell
Leave suggestions for other projects and feedback, maybe some bugs I could fix below!
Amazing!! Really like you what you have created. I am guessing you are inspired by SethBling's work?
Yeah, I watch all of his videos. Though I am inspired more by Dragnoz, that guy can come up with the most amazing stuff! You should check him out on youtube sometime.
I like Dragnoz too. He has made stuff like RPG Classes in Minecraft to Elemental arrows. SethBling is pretty cool aswell