-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganise EMC mapper classes, add network tool NBT processor
- Loading branch information
Showing
5 changed files
with
52 additions
and
10 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...iede/mappers/ChargerRecipeTypeMapper.java → .../emc/mappers/ChargerRecipeTypeMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...de/mappers/InscriberRecipeTypeMapper.java → ...mc/mappers/InscriberRecipeTypeMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...de/mappers/TransformRecipeTypeMapper.java → ...mc/mappers/TransformRecipeTypeMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/java/gripe/_90/appliede/emc/nbt/NetworkToolNBTProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package gripe._90.appliede.emc.nbt; | ||
|
||
import java.math.BigInteger; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import appeng.items.contents.NetworkToolMenuHost; | ||
import appeng.items.tools.NetworkToolItem; | ||
|
||
import gripe._90.appliede.AppliedE; | ||
|
||
import moze_intel.projecte.api.ItemInfo; | ||
import moze_intel.projecte.api.nbt.INBTProcessor; | ||
import moze_intel.projecte.api.nbt.NBTProcessor; | ||
import moze_intel.projecte.api.proxy.IEMCProxy; | ||
|
||
@SuppressWarnings("unused") | ||
@NBTProcessor | ||
public class NetworkToolNBTProcessor implements INBTProcessor { | ||
@Override | ||
public String getName() { | ||
return "AE2NetworkToolProcessor"; | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "Calculates EMC value of the Applied Energistics 2 network tool."; | ||
} | ||
|
||
@Override | ||
public long recalculateEMC(@NotNull ItemInfo itemInfo, long currentEmc) throws ArithmeticException { | ||
if (!(itemInfo.getItem() instanceof NetworkToolItem)) { | ||
return currentEmc; | ||
} | ||
|
||
var stack = itemInfo.createStack(); | ||
var bigEmc = BigInteger.valueOf(currentEmc); | ||
var inventory = new NetworkToolMenuHost(null, -1, stack, null).getInventory(); | ||
|
||
for (var item : inventory) { | ||
var itemEmc = IEMCProxy.INSTANCE.getValue(item); | ||
bigEmc = bigEmc.add(BigInteger.valueOf(itemEmc).multiply(BigInteger.valueOf(item.getCount()))); | ||
} | ||
|
||
return AppliedE.clampedLong(bigEmc); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters