|
| 1 | +package net.p3pp3rf1y.sophisticatedcore.mixin.common; |
| 2 | + |
| 3 | +import net.minecraft.world.entity.player.Player; |
| 4 | +import net.minecraft.world.inventory.CraftingContainer; |
| 5 | +import net.minecraft.world.inventory.ResultSlot; |
| 6 | +import net.minecraft.world.item.ItemStack; |
| 7 | +import net.p3pp3rf1y.sophisticatedcore.event.common.PlayerEvents; |
| 8 | +import org.spongepowered.asm.mixin.Final; |
| 9 | +import org.spongepowered.asm.mixin.Mixin; |
| 10 | +import org.spongepowered.asm.mixin.Shadow; |
| 11 | +import org.spongepowered.asm.mixin.injection.At; |
| 12 | +import org.spongepowered.asm.mixin.injection.Inject; |
| 13 | +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; |
| 14 | + |
| 15 | +@Mixin(ResultSlot.class) |
| 16 | +public class ResultSlotMixin { |
| 17 | + @Shadow @Final private CraftingContainer craftSlots; |
| 18 | + |
| 19 | + @Shadow @Final private Player player; |
| 20 | + |
| 21 | + @Inject(method = "onTake", at = @At("HEAD")) |
| 22 | + public void sophisticatedCore_onTake(Player player, ItemStack stack, CallbackInfo callbackInfo) { |
| 23 | + PlayerEvents.ITEM_CRAFTED.invoker().onItemCrafted(player, stack, craftSlots); |
| 24 | + } |
| 25 | + |
| 26 | + @Inject(method = "onQuickCraft", at = @At("HEAD")) |
| 27 | + public void sophisticatedCore_onQuickCraft(ItemStack stack, int amount, CallbackInfo ci) { |
| 28 | + PlayerEvents.ITEM_CRAFTED.invoker().onItemCrafted(player, stack, craftSlots); |
| 29 | + } |
| 30 | +} |
0 commit comments