-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #61
- Loading branch information
Showing
4 changed files
with
57 additions
and
22 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
27 changes: 27 additions & 0 deletions
27
src/main/java/me/ramidzkh/mekae2/mixin/CondenserMEStorageMixin.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,27 @@ | ||
package me.ramidzkh.mekae2.mixin; | ||
|
||
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 me.ramidzkh.mekae2.ae2.MekanismKey; | ||
import mekanism.api.chemical.attribute.ChemicalAttributeValidator; | ||
|
||
import appeng.api.config.Actionable; | ||
import appeng.api.networking.security.IActionSource; | ||
import appeng.api.stacks.AEKey; | ||
|
||
@Mixin(targets = "appeng.blockentity.misc.CondenserMEStorage") | ||
public class CondenserMEStorageMixin { | ||
|
||
@Inject(method = "insert", at = @At("HEAD"), cancellable = true) | ||
private void onInsert(AEKey what, long amount, Actionable mode, IActionSource source, | ||
CallbackInfoReturnable<Long> cir) { | ||
if (what instanceof MekanismKey key) { | ||
if (!ChemicalAttributeValidator.DEFAULT.process(key.getStack())) { | ||
cir.setReturnValue(0L); | ||
} | ||
} | ||
} | ||
} |
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
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,9 @@ | ||
{ | ||
"required": true, | ||
"minVersion": "0.8.5", | ||
"package": "me.ramidzkh.mekae2.mixin", | ||
"mixins": ["CondenserMEStorageMixin"], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} |