-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Large Miners Not Working with ME Output Hatches
- Loading branch information
1 parent
69dff18
commit 827f025
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
src/main/java/com/nomiceu/nomilabs/mixin/gregtech/MinerLogicMixin.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,43 @@ | ||
package com.nomiceu.nomilabs.mixin.gregtech; | ||
|
||
import java.util.List; | ||
|
||
import net.minecraft.item.ItemStack; | ||
import net.minecraftforge.items.IItemHandler; | ||
|
||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
|
||
import gregtech.api.capability.impl.miner.MinerLogic; | ||
import gregtech.api.metatileentity.MetaTileEntity; | ||
import gregtech.api.metatileentity.multiblock.MultiblockWithDisplayBase; | ||
|
||
/** | ||
* Fixes Multiblock Miners not being able to use ME Output Buses. | ||
*/ | ||
@Mixin(value = MinerLogic.class, remap = false) | ||
public class MinerLogicMixin { | ||
|
||
@Shadow | ||
@Final | ||
protected MetaTileEntity metaTileEntity; | ||
|
||
@WrapOperation(method = "mineAndInsertItems", | ||
at = @At(value = "INVOKE", | ||
target = "Lgregtech/api/util/GTTransferUtils;addItemsToItemHandler(Lnet/minecraftforge/items/IItemHandler;ZLjava/util/List;)Z", | ||
ordinal = 0), | ||
require = 1) | ||
private boolean checkForInfiniteOutput(IItemHandler amountToInsert, boolean amount, List<ItemStack> entry, | ||
Operation<Boolean> original) { | ||
// Whilst Miner does not support Voiding, ME Output Hatch Presence also returns true | ||
if (metaTileEntity instanceof MultiblockWithDisplayBase multi && multi.canVoidRecipeItemOutputs()) { | ||
return true; | ||
} | ||
return original.call(amountToInsert, amount, entry); | ||
} | ||
} |
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