Jump to content

Recommended Posts

Posted (edited)

So I've defined a custom entity behavior called EntityAIFaceOff, and it basically just has my entity find a path to the player and stop at a certain distance. These are the conditions for stopping the execution:

 

Quote

	if (entity.targetofmyrevenge == null)
            return false;
        if (this.outofRange == true)
            return false;
	if (path == null)
		return false;
        return true;

 

It all works fine on solid ground, but when I lead the mob into water it'll stop chasing me because its path to me becomes null. It reverts to its wandering AI and floats around with the swimming AI and wandering AI.

 

I took a look at the zombie's AIs and didn't see anything special it was doing there, I use all the same path finding methods. How exactly does Minecraft's pathfinding work when the mob is in water?

 

Edit: I've sort of replicated the Vanilla one by manually setting the entity's motion to go towards the player if it's in water. Not sure if there's a better way I can do it tho.

Edited by Turtledove
Posted

As far as i know zombies just stop moving and sink when in water, so its a pretty different behaviour to what you are trying to achieve there. I think you should take a look at the SpiderEntity class, for example, as the spider will continue chasing you even when in water. Look also at SwimGoal, NearestAttackableTargetGoal and MeleeAttackGoal classes (which are part of the spider behaviour) to see how they deal with a mob chasing its target while also swimming in water. Anyway, in case that i am completely missing the point or that you already explored the above classes, please, post your entity class code!

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

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.