forked from daviscook477/BaseMod
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix daviscook477#162 PostEnergyRecharge hook
- Loading branch information
Showing
2 changed files
with
27 additions
and
6 deletions.
There are no files selected for viewing
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
32 changes: 26 additions & 6 deletions
32
...ava/basemod/patches/com/megacrit/cardcrawl/core/EnergyManager/PostEnergyRechargeHook.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 |
---|---|---|
@@ -1,13 +1,33 @@ | ||
package basemod.patches.com.megacrit.cardcrawl.core.EnergyManager; | ||
|
||
import basemod.BaseMod; | ||
import com.evacipated.cardcrawl.modthespire.lib.SpireInsertPatch; | ||
import com.evacipated.cardcrawl.modthespire.lib.SpirePatch; | ||
import com.evacipated.cardcrawl.modthespire.lib.*; | ||
import com.megacrit.cardcrawl.actions.GameActionManager; | ||
import com.megacrit.cardcrawl.audio.SoundMaster; | ||
import com.megacrit.cardcrawl.core.EnergyManager; | ||
import javassist.CtBehavior; | ||
|
||
@SpirePatch(cls="com.megacrit.cardcrawl.core.EnergyManager", method="recharge") | ||
public class PostEnergyRechargeHook { | ||
@SpireInsertPatch(rloc=10) | ||
public static void Insert(Object __obj_instance) { | ||
@SpirePatch( | ||
clz=EnergyManager.class, | ||
method="recharge" | ||
) | ||
public class PostEnergyRechargeHook | ||
{ | ||
@SpireInsertPatch( | ||
locator=Locator.class | ||
) | ||
public static void Insert(EnergyManager __instance) | ||
{ | ||
BaseMod.publishPostEnergyRecharge(); | ||
} | ||
|
||
private static class Locator extends SpireInsertLocator | ||
{ | ||
@Override | ||
public int[] Locate(CtBehavior ctMethodToPatch) throws Exception | ||
{ | ||
Matcher finalMatcher = new Matcher.MethodCallMatcher(GameActionManager.class, "updateEnergyGain"); | ||
return LineFinder.findInOrder(ctMethodToPatch, finalMatcher); | ||
} | ||
} | ||
} |