-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Incorporate Amperage into Max Recipe Tier
- Loading branch information
1 parent
1b21a77
commit 2fa87aa
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/main/java/com/nomiceu/nomilabs/mixin/gregtech/MultiblockDisplayTextBuilderMixin.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,31 @@ | ||
package com.nomiceu.nomilabs.mixin.gregtech; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture; | ||
|
||
import com.llamalad7.mixinextras.sugar.Local; | ||
import com.llamalad7.mixinextras.sugar.ref.LocalLongRef; | ||
|
||
import gregtech.api.capability.IEnergyContainer; | ||
import gregtech.api.metatileentity.multiblock.MultiblockDisplayText; | ||
|
||
/** | ||
* Takes into account amperages when showing the Max EU/t of a Multiblock. | ||
*/ | ||
@Mixin(value = MultiblockDisplayText.Builder.class, remap = false) | ||
public class MultiblockDisplayTextBuilderMixin { | ||
|
||
@Inject(method = "addEnergyUsageLine", | ||
at = @At(value = "INVOKE_ASSIGN", target = "Ljava/lang/Math;max(JJ)J"), | ||
require = 1, | ||
locals = LocalCapture.CAPTURE_FAILEXCEPTION) | ||
private void accountAmperages(IEnergyContainer energyContainer, | ||
CallbackInfoReturnable<MultiblockDisplayText.Builder> cir, | ||
@Local LocalLongRef maxVoltage) { | ||
maxVoltage.set(Math.max(energyContainer.getInputVoltage() * energyContainer.getInputAmperage(), | ||
energyContainer.getOutputVoltage() * energyContainer.getOutputAmperage())); | ||
} | ||
} |
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