Posted July 24, 20205 yr 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 July 24, 20205 yr by Turtledove
July 28, 20205 yr 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.