Posted September 11, 20223 yr I want to make an entity that is able to walk in a straight direction where it's looking, and stop either when the path if obstructed (e.g. there's lava) or when a timer runs out, however I don't know where I could begin.
September 11, 20223 yr Look at MoveToBlockGoal and rework it. i.e. Replace findNearestBlock() with your own logic. Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
September 12, 20223 yr Author Sorry for the late reply, was doing stuff. So how exactly would it work? Let's say, I want the entity do play an animation, walk in a straight line, then stop at its tracks when the path in front of it is blocked. I'm also having some trouble trying to get where the entity is facing and set a straight line for it to walk there.
September 12, 20223 yr Quote So how exactly would it work? We are not going to write your mod for you. This is a support forum not a teaching forum. Quote Let's say, I want the entity do play an animation, walk in a straight line, then stop at its tracks when the path in front of it is blocked. You need to look at that code I suggested above. It's part of the entity AI code which has builtin entity PathNavigation and MoveControl you can use. Quote I'm also having some trouble trying to get where the entity is facing and set a straight line for it to walk there. It depends what you mean by "facing". There is an entity.getViewVector() that tells you which direction the entity is looking or there is also the LivingEntity's body rotation, see Panda.afterSneeze() for an example usage of this. You can also do "ray tracing" to see what an entity is looking at, e.g. Entity.pick() This part of your question has been asked and answered in many posts of this forum, so search is your friend if you want a longer answer to this FAQ. Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
September 13, 20223 yr Author Alr, I also didn't mean to ask for code examples, just a basic explanation. Thanks!
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.