Jump to content

[1.8.9] Minecraft reduce the player Velocity on hit


Spookiss

Recommended Posts

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

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.