Need Help having a mob break blocks (without standing on them)

Started by CaptainShark on

Topic category: Help with modding (Java Edition)

Last seen on 06:13, 28. Aug 2023
Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Need Help having a mob break blocks (without standing on them)

At the moment I have a mob who can break blocks I tell them to but they have to be able to stand/jump on them. How can I have them break the ones they are looking at as well?

Last seen on 19:44, 28. Jun 2023
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
did you find any solution…
Thu, 06/15/2023 - 10:03

did you find any solution yet?
there are a lot of posts about this, but nobody ever gave a solution.

Last seen on 00:07, 8. Apr 2024
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I can think of something…
Thu, 06/15/2023 - 12:37

I can think of something.

First, use that procedure template for search for a block in an area. Scale it up to a suitable size. That's how far the entity will search.

Then, if your block is found, go into the if/then that sets the variable to true. Add an if/then/else under that. For the condition, use the distance formula (or taxicab if you prefer) to get the distance between your entity and the chosen block at x + sx, y + sy, z + sz. If this distance is greater than about two or three. That number is the entity's "mining reach." If the distance is greater, the entity will walk to the block. If it's less, it can break it.

Under the "do" part, put the "make entity find path to x y z" block there and change "x y z" to "x + sx, y + sy, z + sz." (I don't remember what the variables were actually called, but the ones used to target a particular block. They're also used in the "if" part of the section that sets the variable to true.) The entity will do this if the block is too far away to break.

Under the "else" part, put your block of choice for breaking things at x + sx, y + sy, z + sz. The entity will do this if it is close enough.

The only problem here is that the breaking doesn't have the animation. It'll probably be instant. On the plus side, your mob will stop walking to defend itself if something attacks it/something it should attack comes by and resume after that's finished.

I apologize if this is hard to follow.

Last seen on 16:22, 1. May 2024
Joined Dec 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Bro, for me it's to hard to…
Mon, 03/04/2024 - 17:54

Bro, for me it's to hard to do. Can you show tutorial on imgur?