Started by
BeePlay
on
Topic category: Help with Minecraft modding (Java Edition)
I am doing a new mod with lots of weapons. How do I make a weapon that does a dash by right click and if you collide with entity, it gets 9 damage, but if you run into the block you get damage and get weakness and slowness?
Try using the "Override motion vector of <entity/target> to <entity Vx> <entity Vz> <entity VZ>" block on "On item right click".
Then create a procedure on "While item in main hand ticks" that checks if the item has been clicked with an NBT variable and if there is an entity in front of the player, using the "For each entity as entity iterator at <X + entity Vx> <Y + entity Vy> Z + entity Vz> in square of 2" block. Inside this block, check that the iterator entity is not the player and apply 9 damage with the "Damage entity..." block.
To be safe, check if the player has finished dashing and set the NBT variable you created to "false". This way, after you use your weapon's ability, if the player doesn't have dashing enabled, it won't deal damage to other entities.