Used in both water and by flying objects
(float strafe, float forward, float friction)
| 1241 | * Used in both water and by flying objects |
| 1242 | */ |
| 1243 | public void moveFlying(float strafe, float forward, float friction) |
| 1244 | { |
| 1245 | float movingYaw = this.rotationYaw; |
| 1246 | if (RotationUtil.isEnabled) { |
| 1247 | if (RotationUtil.strafeFix) { |
| 1248 | if (!RotationUtil.strictStrafeFix) { |
| 1249 | RotationUtil.strafeFixBinds(RotationUtil.clientRotation[0] - MovementUtil.getBindsDirection(Minecraft.getMinecraft().thePlayer.rotationYaw)); |
| 1250 | } |
| 1251 | |
| 1252 | movingYaw = RotationUtil.clientRotation[0]; |
| 1253 | } else if (Slack.getInstance().getModuleManager().getInstance(CombatStrafe.class).isToggle() && AttackUtil.inCombat && Slack.getInstance().getModuleManager().getInstance(Speed.class).isToggle()) { |
| 1254 | movingYaw = RotationUtil.clientRotation[0] + Slack.getInstance().getModuleManager().getInstance(CombatStrafe.class).getOffset(); |
| 1255 | Minecraft.getMinecraft().gameSettings.keyBindForward.pressed = true; |
| 1256 | Minecraft.getMinecraft().gameSettings.keyBindRight.pressed = false; |
| 1257 | Minecraft.getMinecraft().gameSettings.keyBindBack.pressed = false; |
| 1258 | Minecraft.getMinecraft().gameSettings.keyBindLeft.pressed = false; |
| 1259 | } else { |
| 1260 | movingYaw = Minecraft.getMinecraft().thePlayer.rotationYaw; |
| 1261 | } |
| 1262 | } |
| 1263 | StrafeEvent event = new StrafeEvent(strafe, forward, friction, movingYaw); |
| 1264 | if(this == Minecraft.getMinecraft().thePlayer) event.call(); |
| 1265 | if(event.isCanceled()) return; |
| 1266 | if(MovementUtil.onStrafe) { |
| 1267 | MovementUtil.onStrafe = false; |
| 1268 | return; |
| 1269 | } |
| 1270 | |
| 1271 | |
| 1272 | float f = event.getStrafe() * event.getStrafe() + event.getForward() * event.getForward(); |
| 1273 | |
| 1274 | if (f >= 1.0E-4F) { |
| 1275 | f = MathHelper.sqrt_float(f); |
| 1276 | |
| 1277 | if (f < 1.0F) |
| 1278 | { |
| 1279 | f = 1.0F; |
| 1280 | } |
| 1281 | |
| 1282 | f = event.getFriction() / f; |
| 1283 | event.setStrafe(event.getStrafe() * f); |
| 1284 | event.setForward(event.getForward() * f); |
| 1285 | float f1 = MathHelper.sin(event.getYaw() * (float)Math.PI / 180.0F); |
| 1286 | float f2 = MathHelper.cos(event.getYaw() * (float)Math.PI / 180.0F); |
| 1287 | |
| 1288 | this.motionX += event.getStrafe() * f2 - event.getForward() * f1; |
| 1289 | this.motionZ += event.getForward() * f2 + event.getStrafe() * f1; |
| 1290 | } |
| 1291 | |
| 1292 | boolean player = this == Minecraft.getMinecraft().thePlayer; |
| 1293 | if (player) { |
| 1294 | PostStrafeEvent event2 = new PostStrafeEvent(); |
| 1295 | event2.call(); |
| 1296 | } |
| 1297 | } |
| 1298 | |
| 1299 | public int getBrightnessForRender(float partialTicks) |
| 1300 | { |
no test coverage detected