From 6e3b3b20a0f75c0bc12e882ebb630e75748c8f90 Mon Sep 17 00:00:00 2001 From: "Breno A." Date: Sun, 9 Jun 2024 09:38:33 -0300 Subject: [PATCH] refactor: implicit cast from double to float may be lossy --- .../game/managers/stamina/StaminaManager.java | 16 ++++++++-------- .../emu/grasscutter/game/world/Position.java | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/emu/grasscutter/game/managers/stamina/StaminaManager.java b/src/main/java/emu/grasscutter/game/managers/stamina/StaminaManager.java index 79366e79f..037aab174 100644 --- a/src/main/java/emu/grasscutter/game/managers/stamina/StaminaManager.java +++ b/src/main/java/emu/grasscutter/game/managers/stamina/StaminaManager.java @@ -475,7 +475,7 @@ public class StaminaManager extends BasePlayerManager { if (consumption.amount < 0 && isCharacterStamina) { // Do not apply reduction factor when recovering stamina if (player.getTeamManager().getTeamResonances().contains(10301)) { - consumption.amount *= 0.85f; + consumption.amount *= (int) 0.85f; } } // Delay 1 seconds before starts recovering stamina @@ -543,8 +543,8 @@ public class StaminaManager extends BasePlayerManager { consumption.amount = ConsumptionType.CLIMBING.amount; } // Climbing specific reductions - consumption.amount *= getFoodCostReductionFactor(ClimbFoodReductionMap); - consumption.amount *= getTalentCostReductionFactor(ClimbTalentReductionMap); + consumption.amount *= (int) getFoodCostReductionFactor(ClimbFoodReductionMap); + consumption.amount *= (int) getTalentCostReductionFactor(ClimbTalentReductionMap); return consumption; } @@ -560,8 +560,8 @@ public class StaminaManager extends BasePlayerManager { consumption.amount = ConsumptionType.SWIM_DASH.amount; } // Swimming specific reductions - consumption.amount *= getFoodCostReductionFactor(SwimFoodReductionMap); - consumption.amount *= getTalentCostReductionFactor(SwimTalentReductionMap); + consumption.amount *= (int) getFoodCostReductionFactor(SwimFoodReductionMap); + consumption.amount *= (int) getTalentCostReductionFactor(SwimTalentReductionMap); return consumption; } @@ -571,7 +571,7 @@ public class StaminaManager extends BasePlayerManager { consumption.type = ConsumptionType.DASH; consumption.amount = ConsumptionType.DASH.amount; // Dashing specific reductions - consumption.amount *= getFoodCostReductionFactor(DashFoodReductionMap); + consumption.amount *= (int) getFoodCostReductionFactor(DashFoodReductionMap); } return consumption; } @@ -583,8 +583,8 @@ public class StaminaManager extends BasePlayerManager { } Consumption consumption = new Consumption(ConsumptionType.FLY); // Flying specific reductions - consumption.amount *= getFoodCostReductionFactor(FlyFoodReductionMap); - consumption.amount *= getTalentCostReductionFactor(FlyTalentReductionMap); + consumption.amount *= (int) getFoodCostReductionFactor(FlyFoodReductionMap); + consumption.amount *= (int) getTalentCostReductionFactor(FlyTalentReductionMap); return consumption; } diff --git a/src/main/java/emu/grasscutter/game/world/Position.java b/src/main/java/emu/grasscutter/game/world/Position.java index 780a6c213..249f6733e 100644 --- a/src/main/java/emu/grasscutter/game/world/Position.java +++ b/src/main/java/emu/grasscutter/game/world/Position.java @@ -143,8 +143,8 @@ public class Position implements Serializable { /** In radians */ public Position translate(float dist, float angle) { - this.x += dist * Math.sin(angle); - this.y += dist * Math.cos(angle); + this.x += (float) (dist * Math.sin(angle)); + this.y += (float) (dist * Math.cos(angle)); return this; } @@ -173,8 +173,8 @@ public class Position implements Serializable { public Position translateWithDegrees(float dist, float angle) { angle = (float) Math.toRadians(angle); - this.x += dist * Math.sin(angle); - this.y += -dist * Math.cos(angle); + this.x += (float) (dist * Math.sin(angle)); + this.y += (float) (-dist * Math.cos(angle)); return this; }