Started by
HydratedMite
on
Topic category: Help with Minecraft modding (Java Edition)
I want to make a projectile that can hit entities through blocks without destroying the blocks. How do I do this?
Topic category: Help with Minecraft modding (Java Edition)
I want to make a projectile that can hit entities through blocks without destroying the blocks. How do I do this?
Maybe when it hits a block it checks if there is an entity nearby and if so damages them? Or you could check what direction it was moving and when it hits a block it spawns another a few blocks forward.
But I want the projectile to keep going until the end of its range (which is pretty long), completely ignoring any and all blocks it collides with
I don't think that's possible, as far as I know. Sorry
I'm doing something similar and i found that if you use a ray trace to find the side of the block you are looking at you can then turn that into a number variable which you can then run through and "if" scenario you can make it so it spawns an arrow at a location relative to the block you hit (spawns it on the other side of the block), now I've found a bug with this solution that i have yet to find a fix for is that it is required to be a global variable where as for the ideal situation it would be a player persistent variable or some sort of readable nbt data inside the block itself. I'll let you know if i find anything
You can use a custom entity instead, and shoot it forwards.
You can add the following line of code to your custom entity to make it go through blocks (might not work, depending on version):
Just have it deal damage to any entities that collide with it.