A mob that teleports when you hit it

Started by Among on

Topic category: Help with modding (Java Edition)

Last seen on 14:49, 25. Jun 2023
Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
A mob that teleports when you hit it
I'm making a creeper that will teleport when hit and with a 5% chance spawn another creeper when hit. I already have the way the creeper explodes and the procedure for it to teleport, but when I try it it teleports into a void or into a mountain (which suffocates it and it dies) and I don't know how to fix it. Someone knows? (I would also like to know how I do what I said about spawning another creeper with a 5% chance when hit)
Last seen on 19:29, 11. Apr 2024
Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So I'm assuming that the…
Sun, 06/18/2023 - 20:02

So I'm assuming that the block you're using for teleporting the creeper is the "Set location of "{Event/Target Entity} to x: {x} y: {y} z: {z}" In my mind, I see two options that you can take.

A) Add the "Random integer between min: {1} and max: {10}" block into the x and z slots of the first block I mentioned. Then you can just safely choose a range that isn't too far. Granted it doesn't solve the issue directly if you're in a cave which brings me to the next option.

B) Under the "World Data" tab, there's a "Is air at x: {x} y: {y} z: {z}" block. I would use that to check the random range that the creeper can teleport to for air, then if air is there, let it teleport, otherwise no. The only downside is that of you are in a two block space (hypothetically) with no air gaps for a range. Then the creeper wouldn't teleport but this scenario is unlikely unless a player built a containment for the creeper that was big enough to surpass the specified range of the random integer block.

Last seen on 19:29, 11. Apr 2024
Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I meant random number block,…
Sun, 06/18/2023 - 20:03

I meant random number block, not integer.