Carpet

Carpet

2M Downloads

`/player bot stop` command doesn't immediately stop the bot's movement

TejasIsCool opened this issue ยท 2 comments

commented

As said in the title, doing the
/player botname stop command
will not immediately stop the bot's movement(done using the command /player botname move forward). It will slow down eventually, but not immediately.
Showcase of the bug?: This

commented

Alright, figured it out. When the stopMovement() function in the helpers/EntityPlayerActionPack.java gets called when you do the command, it sets the forward and strafing variables to 0. That would be fine to stop the bot, if in the onUpdate() function in the same file actually set the player.zza and player.xxa values to zero when the forward and strafing variables were zero. However, there is an if condition that checks if they are not zero, and only then it updates those player.zza and player.xxa values. It does nothing when the forward and strafing variables are zero. I don't know if its intentional, but if it is, I think there should be a command to set whether the bot stops immediately or slowly stops.

I fixed it by just adding an else statement below both the if statements that just set the player.zza and player.xxa values to zero if the forward and strafing values are zero. The conditions are probably not necessary, as the maths should still work without the if statements, but I didn't know, so I kept them there when testing.

Sorry if this method has issues, or if there is a particular reason for the code being the way it is, as I don't know about it.

commented

I'm implementing this solution rn