Skip to content

Commit

Permalink
Fix Parallelization Output Voiding
Browse files Browse the repository at this point in the history
  • Loading branch information
IntegerLimit committed Aug 20, 2024
1 parent 1c35289 commit eb4fab3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.nomiceu.nomilabs.mixin.gregtech;

import net.minecraft.item.ItemStack;

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.LocalIntRef;

import gregtech.api.util.OverlayedItemHandler;

/**
* Ensures items inputted into new slots take into account the stack's max stack size.
*/
@Mixin(value = OverlayedItemHandler.class, remap = false)
public class OverlayedItemHandlerMixin {

@Inject(method = "insertStackedItemStack",
at = @At(value = "INVOKE",
target = "Lgregtech/api/util/OverlayedItemHandler$OverlayedItemHandlerSlot;setItemStack(Lnet/minecraft/item/ItemStack;)V",
ordinal = 0),
require = 1,
locals = LocalCapture.CAPTURE_FAILEXCEPTION)
private void changeCanInsert(ItemStack stack, int amountToInsert, CallbackInfoReturnable<Integer> cir,
@Local(index = 7) LocalIntRef insertedAmount) {
insertedAmount.set(Math.min(insertedAmount.get(), stack.getMaxStackSize()));
}
}
1 change: 1 addition & 0 deletions src/main/resources/mixins.nomilabs.gregtech.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"MetaTileEntityProcessingArrayMixin",
"MultiblockInfoCategoryMixin",
"OreDictUnifierAccessor",
"OverlayedItemHandlerMixin",
"ProcessingArrayWorkableMixin",
"RecipeBuilderMixin",
"RecipeMapMixin",
Expand Down

0 comments on commit eb4fab3

Please sign in to comment.