Closed U5B closed 2 years ago
Marked as draft since at higher speeds (255) the bot goes faster than vanilla. (13 vs 10) in moved too quickly.
Alright I found an issue with negative acceleration causing the bot's velocity to go negative, so I set acceleration to 0 if it is negative.
To test the bot's speed is accurate enough, I did console.log((vel.x + vel.z) * 20)
after moveEntity on L401 and compared it to Vanilla's speed per second on the mod MiniHud. Unfortunately, I could not find a more accurate speed counter then one to the hundredth.
Code referenced for client-side sprinting:
public void setSprinting(boolean bl) {
super.setSprinting(bl);
AttributeInstance attributeInstance = this.getAttribute(Attributes.MOVEMENT_SPEED);
if (attributeInstance.getModifier(SPEED_MODIFIER_SPRINTING_UUID) != null) {
attributeInstance.removeModifier(SPEED_MODIFIER_SPRINTING);
}
if (bl) {
attributeInstance.addTransientModifier(SPEED_MODIFIER_SPRINTING);
}
}
https://cdn.discordapp.com/attachments/413438067471548427/919712091940732978/1.16.4_Forge_Velocity_Display.jar Forge mod going to be used to compare prismarine-physics numbers to vanilla's numbers with different speed modifiers.
code looks super magical what can be done to make it clearer to the reader what's going on?
I looked at vanilla code and reproduced it here. I hope this commit makes it more readable.
attribute movementSpeed is used for sprinting and effect speed modification sprinting and effect speed modification is server-side
Source Code from DecomplierMC - 1.16.4