Budschie Posted September 9, 2022 Share Posted September 9, 2022 Hello, whilst experimenting with copying attribute maps from a chicken to a player, I stumbled across one peculiar little detail. When copying the movement speed attribute to the player, they become extremely fast. After looking at the code, I could indeed verify that the movement speed of the chicken is (in theory) indeed higher than the speed of the player - the chicken has a movement speed of 0.25D while the player only has a movement speed of 0.1F. I looked deeper in the code and could verify that the chicken's WaterAvoidingRandomStrollGoal has a speed modifier of 1.0D, which means that the movement of the chicken (0.25D) should in theory not be altered. This interesting behavior is not unique to the chicken though - it applies to pretty much every living entity as well. So, this begs the question: Why? Why is the chicken in practice slower than the player? For me, there are two possibilities: Either the player moves too fast for their speed value, or the chicken moves too slow. As of now, I could not verify either of those possibilities. By the way, the reason why I even sought the solution of this issue is that I am currently in the process of creating a new version for my morph mod, and I would like to set the player's speed to the speed of the entity in which you're currently morphed into. I'd be very grateful if someone could help me with this topic, as my expertise and trivia in regards to the code of Minecraft (as well as the hour that I spent trying to solve this issue) is evidently not enough to solve this mystery. With kind regards, - Budschie Quote Link to comment Share on other sites More sharing options...
warjort Posted September 9, 2022 Share Posted September 9, 2022 Whenever I look at the movement code in Minecraft, it always makes my head hurt. 🙂  I can't give you a definite answer, but I think you want to look at how zza is changed in Mob.setSpeed() vs LocalPlayer.serverAiStep() and follow the rabbit hole. Basically, it is setting the forward impulse to the speed for Mobs, but giving players a forward impulse of 1.0f when they hold the key down. See KeyboardInput. The speed is used later in LivingEntity.handleRelativeFrictionAndCalculateMovement()   Quote 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. Link to comment Share on other sites More sharing options...
warjort Posted September 9, 2022 Share Posted September 9, 2022 (edited) If you are planning on changing the base movement speed for players, you are probably going to have to look at how Abilities.walkingSpeed is used. Edited September 9, 2022 by warjort Quote 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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.