Skip to content

Commit

Permalink
Better address #20 by taking into account the "amount per operation" …
Browse files Browse the repository at this point in the history
…when transmuting
  • Loading branch information
62832 committed Nov 11, 2024
1 parent 0c3158d commit 83abf1c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/main/java/gripe/_90/appliede/AppliedEConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public class AppliedEConfig {
private AppliedEConfig(ForgeConfigSpec.Builder builder) {
moduleEnergyUsage = builder.comment("The amount of AE energy per tick used by the ME Transmutation Module.")
.defineInRange("moduleEnergyUsage", 25.0, 0, Double.MAX_VALUE);
transmutationPowerMultiplier = builder.comment(
"The amount of AE energy used to transmute 1 EMC through the ME Transmutation Module.")
transmutationPowerMultiplier = builder.comment("The amount of AE energy used to transmute items, per 2000 EMC.")
.defineInRange("transmutationPowerMultiplier", 1.0, 0, Double.MAX_VALUE);
emcPerByte = builder.comment(
"The number of EMC units (of any tier) per byte as used in AE2 auto-crafting.",
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/gripe/_90/appliede/me/service/EMCStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import gripe._90.appliede.AppliedE;
import gripe._90.appliede.AppliedEConfig;
import gripe._90.appliede.me.key.EMCKey;
import gripe._90.appliede.me.key.EMCKeyType;
import gripe._90.appliede.menu.TransmutationTerminalMenu;

import moze_intel.projecte.api.ItemInfo;
Expand Down Expand Up @@ -323,7 +324,8 @@ private List<IKnowledgeProvider> getProvidersForExtraction(IActionSource source)
private long getAmountAfterPowerExpenditure(BigInteger maxEmc, BigInteger itemEmc) {
var energyService = service.getGrid().getEnergyService();
var multiplier = BigDecimal.valueOf(PowerMultiplier.CONFIG.multiplier)
.multiply(BigDecimal.valueOf(AppliedEConfig.CONFIG.getTransmutationPowerMultiplier()));
.multiply(BigDecimal.valueOf(AppliedEConfig.CONFIG.getTransmutationPowerMultiplier()))
.divide(BigDecimal.valueOf(EMCKeyType.TYPE.getAmountPerOperation()), 4, RoundingMode.HALF_UP);
var toExpend = new BigDecimal(maxEmc).multiply(multiplier).min(BigDecimal.valueOf(Double.MAX_VALUE));

var available = energyService.extractAEPower(toExpend.doubleValue(), Actionable.SIMULATE, PowerMultiplier.ONE);
Expand Down

0 comments on commit 83abf1c

Please sign in to comment.