Skip to content

Commit 68e2b82

Browse files
Mithi83shartte
andauthored
Balance annihilation plane enchantment energy cost (#8590)
The current implementation had two problems: Enchanting an annihilation plane with any level of efficiency (and nothing else) would reduce the required energy to zero due to multiplying with the 0 in levelSum directly. Enchanting an annihilation plane with unbreaking would increase the energy cost by a factor of 8 per level of unbreaking, but only leading to an average saving of 50% (lv1), 33% (lv2), or 25% (lv3), effectively increasing the average cost rather than reducing it. Fixes #8188 --------- Co-authored-by: Sebastian Hartte <shartte@users.noreply.github.com>
1 parent d5ad76a commit 68e2b82

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/main/java/appeng/parts/automation/ItemPickupStrategy.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,11 @@ protected float calculateEnergyUsage(ServerLevel level, BlockPos pos, List<ItemS
270270
int randomNumber = level.getRandom().nextInt(unbreakingLevel + 1);
271271
useEnergy = randomNumber == 0;
272272
}
273+
// Increase energy usage 8x for each *other* enchantment that might affect the pickup.
274+
// Ignore efficiency & unbreaking since we did account for them here explicitly.
273275
var levelSum = enchantments.entrySet().stream().map(Map.Entry::getValue).reduce(0, Integer::sum)
274-
- efficiencyLevel;
275-
requiredEnergy *= 8 * levelSum * efficiencyFactor;
276+
- efficiencyLevel - unbreakingLevel;
277+
requiredEnergy *= (levelSum > 0 ? 8 * levelSum : 1) * efficiencyFactor;
276278
}
277279

278280
return useEnergy ? requiredEnergy : 0;

0 commit comments

Comments
 (0)