-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/main/java/com/mitchej123/hodgepodge/mixins/early/minecraft/MixinInventoryCrafting.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,32 @@ | ||
package com.mitchej123.hodgepodge.mixins.early.minecraft; | ||
|
||
import net.minecraft.inventory.Container; | ||
import net.minecraft.inventory.IInventory; | ||
import net.minecraft.inventory.InventoryCrafting; | ||
import net.minecraft.item.ItemStack; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Overwrite; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
@Mixin(InventoryCrafting.class) | ||
public class MixinInventoryCrafting { | ||
|
||
@Shadow | ||
private ItemStack[] stackList; | ||
|
||
@Shadow | ||
private Container eventHandler; | ||
|
||
/** | ||
* @author kuba6000 | ||
* @reason Optimize InventoryCrafting | ||
*/ | ||
@Overwrite | ||
public void setInventorySlotContents(int index, ItemStack stack) { | ||
if (stack == null && this.stackList[index] == null) return; | ||
this.stackList[index] = stack; | ||
this.eventHandler.onCraftMatrixChanged((IInventory) this); | ||
} | ||
|
||
} |