fixed an issue where crafting events were not being fired (#2838)

This commit is contained in:
Darkere
2021-01-20 14:06:43 +01:00
committed by GitHub
parent d4b382c4db
commit c1d97cf49a

View File

@@ -4,6 +4,8 @@ import com.refinedmods.refinedstorage.api.network.grid.IGrid;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.container.CraftingResultSlot; import net.minecraft.inventory.container.CraftingResultSlot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.fml.hooks.BasicEventHooks;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@@ -21,11 +23,15 @@ public class ResultCraftingGridSlot extends CraftingResultSlot {
@Nonnull @Nonnull
public ItemStack onTake(PlayerEntity player, @Nonnull ItemStack stack) { public ItemStack onTake(PlayerEntity player, @Nonnull ItemStack stack) {
onCrafting(stack); onCrafting(stack);
ForgeHooks.setCraftingPlayer(player);
if (!player.getEntityWorld().isRemote) { if (!player.getEntityWorld().isRemote) {
grid.onCrafted(player, null, null); grid.onCrafted(player, null, null);
} }
BasicEventHooks.firePlayerCraftingEvent(player, stack.copy(), grid.getCraftingMatrix());
ForgeHooks.setCraftingPlayer(null);
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
} }