Started by
Minecraft_guy881
on
Topic category: Help with Minecraft modding (Java Edition)
I am trying to make a ranged item shoot blocks, everything has been going well expect the fact that it replaces other blocks. I would like a projectile that when it hits the block it collides with it and doesn't replace it but instead, lets the block summon next to it. I have tried replacing (y) with (y-1) but blocks are still being replaced.
You'll need to have an added condition to check for air around where your projectile hits, keeping in mind that the 'when projectile hits block' procedure triggers at the position of the hit block. y-1 would be checking the block below this.
Essentially, you would want to check if there was air at the block at y+1; if there isn't, check the block at x+1, then z+1, then x-1, then z-1, and then y-1, essentially checking each of the adjacent blocks, and only placing the desired block if there's air available in that space.
If it's not a problem, could you show me a picture of how the procedure would look like?
This is a snippet of something I used for an ice blaster. (This triggers when the projectile hits a block.) The Random things do a 70% chance for each block, (So it isn't always a perfect shape), then checks if the block at the projectile's position is water, or if it's air and it's raining. (You might just need to be more precise for the projectile position, I assume just using x/y/z gives the position of the block, not the projectile.) If it finds water or air, it places an ice block.
Thanks!