-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Dupe Bug with GT Tools and XU2 Enchanter
Fixes Nomi-CEu/Nomi-CEu#770 Superseeds #22
- Loading branch information
1 parent
02bb13f
commit 9a60008
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/extrautils2/IMachineRecipeMixin.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.extrautils2; | ||
|
||
import java.util.Map; | ||
|
||
import net.minecraft.item.ItemStack; | ||
import net.minecraftforge.fluids.FluidStack; | ||
|
||
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 com.google.common.collect.ImmutableMap; | ||
import com.rwtema.extrautils2.api.machine.IMachineRecipe; | ||
import com.rwtema.extrautils2.api.machine.MachineSlotFluid; | ||
import com.rwtema.extrautils2.api.machine.MachineSlotItem; | ||
import com.rwtema.extrautils2.machine.TileMachine; | ||
|
||
/** | ||
* Fixes XU2 Machine Recipes not consuming GT Tools Correctly, especially evident in the Enchanter. | ||
* <p> | ||
* This causes a dupe bug of GT Tools. | ||
*/ | ||
@Mixin(value = IMachineRecipe.class, remap = false) | ||
public interface IMachineRecipeMixin { | ||
|
||
/** | ||
* Overrides (most) XU2 Machine Recipes to return a empty map instead of a map of collections of items, populated | ||
* via {@link net.minecraftforge.common.ForgeHooks#getContainerItem(ItemStack)}. | ||
* <p> | ||
* This is because ItemGTTool overrides that method, in order to damage, instead of consume, GT Tools in Crafting | ||
* Recipes. | ||
* <p> | ||
* See {@link TileMachine#consumeInputs()} for why this works. Essentially, if there is no container item map for | ||
* the specified slot, an Empty ItemStack is used instead. | ||
*/ | ||
@Inject(method = "getContainerItems", at = @At("HEAD"), cancellable = true) | ||
default void getEmptyStacks(Map<MachineSlotItem, ItemStack> inputItems, | ||
Map<MachineSlotFluid, FluidStack> inputFluids, | ||
CallbackInfoReturnable<Map<MachineSlotItem, ItemStack>> cir) { | ||
cir.setReturnValue(ImmutableMap.of()); | ||
} | ||
} |
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