Started by
CaptainShark
on
Topic category: Help with Minecraft modding (Java Edition)
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?
did you find any solution yet?
there are a lot of posts about this, but nobody ever gave a solution.
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.
Bro, for me it's to hard to do. Can you show tutorial on imgur?