Spawn entity in nearest air block when projectile hits block

Started by Falkspyro on

Topic category: Help with modding (Java Edition)

Last seen on 13:37, 12. Jun 2023
Joined Dec 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Spawn entity in nearest air block when projectile hits block

This title might fit better than the previous one.

In my mod, you catch mobs in small capsules, you can use these capsules as ammo in a gun. Everything is set up. Even the spawning of the mob when the projectile from the gun hits an entity or block. I have figured out how to save the entity from suffocating in the ground. However when hitting a block vertically(from the side) The mob still spawns inside of a block. Therefore it often ends up suffocating.

Would there be a way to check for the nearest air block and spawn the entity there?

This is pretty much the last thing my mod needs. Answers would be very appreciated! And please don't just say "Just do y+1". 

TLDR: I need a way to spawn an entity when my projectile hits a block vertically, without the entity suffocating and dying.

 

Last seen on 13:37, 12. Jun 2023
Joined Dec 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
damn this forum real dead ;(…
Tue, 09/06/2022 - 15:58

damn this forum real dead ;(