Started by
NeverNicholas
on
Topic category: Help with Minecraft modding (Java Edition)
I want to make a pickaxe that when right clicked will shoot forward and go a few blocks out then come back all in a straight line of where the player is looking, mining the blocks in that line, also being able to damage players and mobs, maybe also being able to bounce off certain blocks any help is greatly appreciated also I am using 2024.4 since I needed to use geckolib
You can make a projectile of your pickaxe and then the same way as a trident, you right click, item is removed from main hand and a projectile is shot forward. You then use on projectile tick, use the procedure template find block in 6x6x6 area. Switch the values to a 3x3x3 area, then on each check of the block, replace that with a break block and dropped item. Get the speed of the projectile in blocks, eg 1 block per second = 1block per 20 ticks, so if you want 9 blocks ahead of you then the projectile should turn around after (9x20)-1 because of 3x3x3 area= 179, number of ticks entity has been alive =179, override motion vector to delta movement -1 to make it go straight back, also set gravity to off and all other velocities in the projectile. Then check when ticks =179*2=358, despawn entity. On the item procedure, where you right click and remove item from main hand, use a wait 358 ticks, then add item back to main hand. Potentially you should save the item as a local itemstack variable, top right of procedure window, and then add that back after. This might maintain the data on the pickaxe, enchantments, durability etc. If not you need to save all of that information beforehand and apply it to the item as you give it back to the player.