Jump to content

minecraft entity path block


Soulas97

Recommended Posts

how to make that when entity colides or just a block blocks path that entity would destroy it?

 

i want to my mod when gravel or sand is blocking the path to destroy it

Proud mod developer of:

 

Mob Armor mod

Block monster mod

Clay Living Dolls mod

Much More Spiders mod

Elemental cows reborn

Mr gorilla mod

Link to comment
Share on other sites

What do you mean? How can a path be blocked and still be a path? Are you making some sort of massive destruction mob that just destroys all the blocks around it wherever it goes?

By the way, destroying a block of sand may not unblock a path unless there are none above that one, otherwise you just get an avalanche of more sand/gravel.

Link to comment
Share on other sites

The problem is that entities' pathfinding code currently tries to find paths around blocks.  So for an entity to try to go through blocks (while destroying them) you'd have to make an entirely different pathfinding.  However it may be possible to trick the entities to find paths through blocks by playing with the addCollisionBoxesToList and collisionRayTrace methods of the blocks.  What you could do is to make your own replacement custom blocks that extend the vanilla blocks that you want to be breakable.  You would @Override the addCollisionBoxesToList() and collisionRayTrace() methods such that if the block was at same level as the entity it would have no collision, and then I think the path finding will let it through.  Then when it actually goes into it you can break it.

 

Alternatively, perhaps you could override the AI all together and replace with your own AI that always moves in straight line towards the target and when it gets really close to the blocks while trying to get through it will break the block.

 

Note one trick is that standard blocks and entities never really collide, because they keep outside the bounding box.  Entities only really go "inside" a block if it is a type that allows it, like a portal or web or similar.

 

Not sure if any of the above suggestions help. Overall it is very difficult to do with vanilla blocks and entities, but might be fairly easy with a custom entity or custom blocks.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.