Skip to content

Commit

Permalink
Fix lag with food
Browse files Browse the repository at this point in the history
  • Loading branch information
kuba6000 committed Dec 27, 2024
1 parent 16ed4e0 commit abd5250
Showing 1 changed file with 32 additions and 0 deletions.
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);
}

}

0 comments on commit abd5250

Please sign in to comment.