Jump to content

How to prevent an entity from crossing a custom block?


OsHeaven

Recommended Posts

hi,

 

i want to build a block, that hostile mobs dont want to cross…

 

is there a possibility to change the pathNodeType in relation to the Entity what is collided with this block?

 

getAiPathNodeType() in relation to onEntityCollidedWithBlock() does not work

 

 

 

Link to comment
Share on other sites

I do not think this is possible because you don't have a reference to the entity which initiates the pathing check whatsoever. I suppose you might be able to replace the basic EntityMoveHelper with your wrapper that does the check for your specific block but this might cause incompatibilities with mods that attempt to do the same.

Link to comment
Share on other sites

You need to update the pathfinding code if you want the AI smart enough to avoid that block.  You can create custom PathNodeType objects (even though its an enum) using a Forge class called EnumHelper.  Example:

 

LADDER = EnumHelper.addEnum(PathNodeType.class, MODID + "LADDER", parameterTypes, 0.0F);  //0.0 means its as good as OPEN or WALKABLE

 

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.