Is there a way to make a ranged item shoot a block as a Projectile without replacing other blocks?

Started by Minecraft_guy881 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jan 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Is there a way to make a ranged item shoot a block as a Projectile without replacing other blocks?

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.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You'll need to have an added…
Sat, 10/07/2023 - 18:12

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.

Joined Jan 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If it's not a problem, could…
Sat, 10/07/2023 - 21:26

If it's not a problem, could you show me a picture of how the procedure would look like?

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This is a snippet of…
Wed, 10/11/2023 - 01:42

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.