Hello, i'm trying to make a function to reduce the player knockback, so i did this :
public void reduceVelocity(EntityPlayer player) {
if(isVelocityToggle){
mc.thePlayer.sendChatMessage("on");
player.motionX *= 0.5;
player.motionY *= 0.5;
player.motionZ *= 0.5;
mc.thePlayer.velocityChanged = true;
String motionX= player.motionX+"";
String motionY= player.motionY+"";
String motionZ= player.motionZ+"";
mc.thePlayer.sendChatMessage("motion X : "+motionX);
mc.thePlayer.sendChatMessage("motion Y : "+motionY);
mc.thePlayer.sendChatMessage("motion Z : "+motionZ);
}
else{
mc.thePlayer.sendChatMessage("off");
player.motionX *= 1;
player.motionY *= 1;
player.motionZ *= 1;
mc.thePlayer.sendChatMessage(player.getName());
String motionX= player.motionX+"";
String motionY= player.motionY+"";
String motionZ= player.motionZ+"";
mc.thePlayer.sendChatMessage("motion X : "+motionX);
mc.thePlayer.sendChatMessage("motion Y : "+motionY);
mc.thePlayer.sendChatMessage("motion Z : "+motionZ);
}
}
But the knockback of the player remains the same, even if the values of the motions have changed.
Screenshot