Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //assuming thePlayer = your player reference
- //call this every player tick in your mod_ file (will force player to move forward really fast)
- setRelVel(thePlayer,0.0F,(float)thePlayer.motionY,1.0F,0.7F);
- //now for the setRelVel function, just add it to your mod_ file
- public static void setRelVel(Entity entity, float x, float y, float z, float force)
- {
- setRelVel(entity,entity,x,y,z,force);
- }
- public static void setRelVel(Entity entity, Entity entity2, float x, float y, float z, float force)
- {
- float f4 = 10F;
- float f5 = 0.0F;
- float f6 = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * f4;
- int i = (int)Math.floor((double)(f6 / 360F) + 0.5D);
- f6 = (f6 - (float)i * 360F) + 270F;
- if(z <= 0.0F && z < 0.0F)
- {
- f6 += 180F;
- }
- if(x > 0.0F)
- {
- f6 += 90F - z * 10F;
- } else
- if(x < 0.0F)
- {
- f6 += 270F + z * 10F;
- }
- float f7 = MathHelper.cos(-f6 * 0.01745329F - 3.141593F);
- float f8 = MathHelper.sin(-f6 * 0.01745329F - 3.141593F);
- float f9 = -MathHelper.cos(-f5 * 0.01745329F - 0.7853982F);
- float f10 = MathHelper.sin(-f5 * 0.01745329F - 0.7853982F);
- float f11 = f7 * f9;
- float f12 = f10;
- float f13 = f8 * f9;
- if(x == 0.0F && z == 0.0F)
- {
- entity2.setVelocity((float)entity2.motionX / 2.0F, y, (float)entity2.motionZ / 2.0F);
- } else
- {
- entity2.setVelocity(f11 * force * -1F, y, f13 * force);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement