use of org.spongepowered.asm.mixin.injection.Surrogate in project SpongeCommon by SpongePowered.
the class MixinBlockDropper method afterDispense.
@Surrogate
private void afterDispense(World worldIn, BlockPos pos, CallbackInfo callbackInfo, BlockSourceImpl blocksourceimpl, TileEntityDispenser tileentitydispenser, int i, ItemStack itemstack, ItemStack itemstack1) {
// after setInventorySlotContents
tileentitydispenser.setInventorySlotContents(i, itemstack1);
// Transfer worked if remainder is one less than the original stack
if (itemstack1.getCount() == itemstack.getCount() - 1) {
IMixinInventory capture = forCapture(tileentitydispenser);
Inventory sourceInv = toInventory(tileentitydispenser);
SpongeCommonEventFactory.captureTransaction(capture, sourceInv, i, itemstack);
EnumFacing enumfacing = (EnumFacing) worldIn.getBlockState(pos).getValue(BlockDispenser.FACING);
BlockPos blockpos = pos.offset(enumfacing);
IInventory iinventory = TileEntityHopper.getInventoryAtPosition(worldIn, (double) blockpos.getX(), (double) blockpos.getY(), (double) blockpos.getZ());
SpongeCommonEventFactory.callTransferPost(capture, sourceInv, toInventory(iinventory));
}
callbackInfo.cancel();
}
Aggregations